Say I have a list  list = ["1","2","1","3"]   and I want to get rid of the duplicate 1's but I want to keep one copy so the list would read  list = ["1","2","3"]   I know I can use set() to get rid of the duplicates, but I will not be able to keep a copy. How would I go about keeping a copy?
Is there a built-in that removes duplicates from list in Python, whilst preserving order? I know that I can use a set to remove duplicates, but that destroys the original order. I also know that I can roll my own like this:  def uniq(input):   output = []   for x in input:     if x not in output:       output.append(x)   return output   (Thanks to  for that .)  But I'd like to avail myself of a built-in or a more Pythonic idiom if possible.  Related question:
I know that if the moment generating function of two distribution converges to the same function then the two distribution converges in CDF. But how can we prove this thing explicitly ? JMustache attribution is incorrectly listed as Butterknife How to make a logo where a letter is made of particles of varying sizes? How can I make a logo in Adobe Illustrator like the AntiParticle logo below, from ?   It is a large number circles of different, varying sizes, which form the shape of a text character. The Safari Back Button Problem I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years.   A few days ago I got a call "The website is locking up for people using Safari!" Okay, step one download Safari(v3.1.2), step two surf to the site. Everything appears to work fine.  Long story short I finally isolated the problem and it relates to Safari's back button. The website uses a fancy-pants javascript menu that works in every browser I've tried including Safari, the first time around. But in Safari if you follow a link off the page and then hit the back button the menu no longer works.  I made a pared down webpage to illustrate the principle.  &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt;&lt;title&gt;Safari Back Button Test&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt; &lt;/head&gt; &lt;body onload="alert('Hello');"&gt; &lt;a href="http://www.codinghorror.com"&gt;Coding Horror&lt;/a&gt; &lt;/body&gt; &lt;/html&gt;   Load the page and you see the alert box. Then follow the link off the page and hit the back button. In IE and Firefox you see the alert box again, in Safari you do not.  After a vigorous googling I've discovered others with similar problems but no really satisfactory answers. So my question is how can I make my pages work the same way in Safari after the user hits the back button as they do in other browsers?  If this is a stupid question please be gentle, javascript is somewhat new to me. Can I fly back to Italy if my Italian residency card has expired and is being renewed? Triangle Inequality question with fractions Given $a, b \in \mathbb{R}$, prove that   $$\frac{|a + b|}{1 + |a + b|} \le \frac{|a|}{1 + |a|} + \frac{|b|}{1+|b|}$$  When does equality hold?  The only useful thing I could get (using the triangle inequality) is:  $$\begin{align}1 + \left|\left(a + \frac{ab}{2}\right) + \left(b - \frac{ab}{2}\right)\right| &amp;\le 1 + \left|a + \frac{ab}{2}\right| + \left|b - \frac{ab}{2}\right|\\ &amp;\le 1 + |a| + |b| + |ab|\\ &amp;=(1 + |a|)(1 + |b|)\end{align}$$  But it seems to be inapplicable! Any ideas? OSX Server: should I use Open Directory? How to replace an old version of Ubuntu with a newer one from USB/DVD? I dual booted ubuntu 11.04/11.10 a while ago with a USB stick and i want to uninstall it.   I would like to completely uninstall the old version and get 12.04.  I have a 64 bit laptop. Please help! Why does work depend on distance? So the formula for work is$$ \left[\text{work}\right] ~=~ \left[\text{force}\right]  \, \times \, \left[\text{distance}\right] \,. $$  I'm trying to get an understanding of how this represents energy.  If I'm in a vacuum, and I push a block with a force of $1 \, \mathrm{N},$ it will move forwards infinitely. So as long as I wait long enough, the distance will keep increasing. This seems to imply that the longer I wait, the more work (energy) has been applied to the block.  I must be missing something, but I can't really pinpoint what it is.  It only really seems to make sense when I think of the opposite scenario: when slowing down a block that is (initially) going at a constant speed. I'm getting "jumpy" loadings in rollapply PCA in R. Can I fix it? I have 10 years of daily returns data for 28 different currencies. I wish to extract the first principal component, but rather than operate PCA on the whole 10 years, I want to rollapply a 2 year window, because the currencies' behaviours evolve and so I wish to reflect this. However I have a major problem, that is that both the princomp() and prcomp() functions will often jump from positive to negative loadings in adjacent PCA analyses (ie 1 day apart). Have a look at the loading chart for the EUR currency:    Clearly I can't use this because adjacent loadings will jump from positive to negative, so my series which uses them will be erroneous. Now take a look at the absolute value of the EUR currency loading:    The problem is of course that I still cannot use this because you can see from the top chart that the loading does go from negative to positive and back at times, a characteristic which I need to preserve.   Is there any way I can get around this problem? Can I force the eigenvector orientation to always be the same in adjacent PCAs?   By the way this problem also occurs with the FactoMineR PCA() function. The code for the rollapply is here:  rollapply(retmat, windowl, function(x) summary(princomp(x))$loadings[, 1], by.column = FALSE, align = "right") -&gt; princomproll Is it possible to resize an image in an answer? For example,  has  that should have the image in the answer, but it's too big.  Is there a way to handle resizing? Mars needs water and women I read this book in high school too many years ago for me to think about. Martian colonist are raiding earth's oceans for water and because of the conditions on Mars where only male children are conceived, they are also on the look out for young women as potential mates. Our main character while on a raid, bags not only a young woman but her brother as well. Returning to Mars they find that Earth has attacked Mars can't remember much more. Is it possible to animate which characters of a text object are assigned to a material? Can polymorph and true polymorph change a PC's race and sex? How to solve the functional equation $f\left(x^2+f(y)\right)=y+f(x)^2$ How to solve the following functional equation:  Find all $f:\mathbb{R}\to\mathbb{R} $ such that: $$ f\left(x^2+f(y)\right)=y+f(x)^2 $$ Holds for every $x,y\in\mathbb{R}$.  A friend gave it to me, probably its an olympiad question.  I started with the equation $f(f(y))=y+f(0)^2$ which seems to be quite helpful, but I couldn't do it effectively. How to solve it properly? Proof that all abelian simple groups are cyclic groups of prime order Just wanted some feedback to ensure I did not make any mistakes with this proof. Thanks!  Since $G$ is abelian, every subgroup is normal. Since $G$ is simple, the only subgroups of $G$ are $1$ and $G$, and $|G| &gt; 1$, so for some $x\in G$ we have $x\neq 1$ and $\langle x\rangle\leq G$, so $\langle x\rangle = G$. Suppose $x$ has either infinite order or even order. Then $\langle x^2\rangle \leq G$ but $\langle x^2\rangle \neq \langle x \rangle$, a contradiction. So $x$, and therefore $G$, has odd order, and by Feit-Thompson, $G\cong Z_p$ for some prime $p$.  Edit: Thanks, I see that Feit-Thompson is too much.  Since $G$ is abelian, every subgroup is normal. Since $G$ is simple, the only subgroups of $G$ are $1$ and $G$, and $|G| &gt; 1$, so for some $x\in G$ we have $x\neq 1$ and $\langle x\rangle\leq G$, so $\langle x\rangle = G$. Suppose $x$ has infinite order. Then $\langle x^2\rangle \leq G$ but $\langle x^2\rangle \neq \langle x \rangle$, a contradiction. So $x$, and therefore $G$, has finite order. Suppose $x$ has composite order $n$ so for some $p &gt; 1$ that divides $n$, $\langle x^p \rangle$ is a proper non-trivial subgroup of $G$, so $G$ is not simple. So $G$ is a cyclic group of prime order. Editing network interfaces without system rebooting I'd like to make some changes to my networking configuration by editing my /etc/network/interfaces file. What's the cleanest way to make changes to this file and have them take effect, without having to reboot? Typically, I've been doing:   Edit the file service networking restart   But I have the impression that this isn't the "right" way to make these kinds of changes. If $f(x)$ is differentiable at x, I need to prove that $\lim_{h\to0}\frac{f(x+h)-f(x-h)}{2h}$ exist and is finite.  so if $f(x)$ is differentiable at a $x$, the difference quotient exist for this point, and also $f(x)$ must be continuous at x as well  so that mean that:  $\lim_{h\to0^+}\frac{f(x+h)-f(x)}{h} =  \lim_{h\to0^-}\frac{f(x+h)-f(x)}{h}$  and that: $\lim_{x\to x_0^+}=\lim_{x\to x_0^-}=f(x_0)$  I know I should probably use arithmetic limit laws to prove this but I can't see how what I figured out could help me. any help with that?  Thanks! Why are there humans in the Star Wars Universe? Kind of brought to my attention by .  The poster mentions non-humans, which implies that there are humans in the Star Wars universe.  However, since it happened "A long time ago, in a galaxy far far away", how could there be any humans in the Star Wars universe?  Are there "humans" in Star Wars there just because it was easier to make the movies that way?  Other shows such as Star Trek are about the future of humans, so it's easy to understand the existence of humans in those storylines.  However for Star Wars it just doesn't make sense.  It also seems odd that they'd go around creating all these different species and then just leave the main characters as humans. I guess another possibility is that the humans in star Wars eventually populated Earth, but then what happened to all the technology? How does a  work? If seen from the outer side, we can see through thinking it is transparent, while if seen from the inside, the glass acts as a mirror. How?