<br><div class="gmail_quote">On Wed, Mar 27, 2013 at 10:11 PM, Shane Green <span dir="ltr"><<a href="mailto:shane@umbrellacode.com" target="_blank">shane@umbrellacode.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>[seen.added(value) for value in sequence if value not in seen] * </div><div></div></blockquote></div><div><br></div><div>Here's an easy way to do it:</div><div><br></div><div><div><div><font face="courier new, monospace">>>> seen = set()</font></div>
<div><font face="courier new, monospace">>>> seq = [3,2,1,2,3,4,5,4]</font></div><div><font face="courier new, monospace">>>> <span style="background-color:rgb(255,255,153)">[seen.add(v) or v for v in seq if v not in seen]</span></font></div>
<div><font face="courier new, monospace">[3, 2, 1, 4, 5]</font></div><div><font face="courier new, monospace">>>> seen</font></div><div><font face="courier new, monospace">{1, 2, 3, 4, 5}</font></div></div></div>
<div><br></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">--- Bruce</font><div><span style="font-family:arial,helvetica,sans-serif">Latest blog post: Alice's Puzzle Page </span><a href="http://www.vroospeak.com/" style="font-family:arial,helvetica,sans-serif" target="_blank">http://www.vroospeak.com</a></div>
<div><div><font face="arial, helvetica, sans-serif">Learn how hackers think: <a href="http://j.mp/gruyere-security" target="_blank">http://j.mp/gruyere-security</a></font></div></div></div>