[Python-ideas] Uniquify attribute for lists

Jasper St. Pierre jstpierre at mecheye.net
Fri Nov 16 19:22:00 CET 2012


As long as we're giving terrible code suggestions:

[a for a in L if a not in locals("_[0]")]


On Fri, Nov 16, 2012 at 9:37 AM, Serhiy Storchaka <storchaka at gmail.com>wrote:

> On 16.11.12 15:17, Michael Foord wrote:
>
>> On 16 November 2012 12:39, Paul Moore
>> <p.f.moore at gmail.com
>> <mailto:p.f.moore at gmail.com>> wrote:
>>
>
>      list(set(ls))
>>
>>
>> This loses order.
>>
>
> list(collections.OrderedDict.**fromkeys(ls))
>
>
>
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/**mailman/listinfo/python-ideas<http://mail.python.org/mailman/listinfo/python-ideas>
>



-- 
  Jasper
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121116/b5a773c4/attachment.html>


More information about the Python-ideas mailing list