Re: duplicate items in a list

2005-11-21 Thread drochom
http://groups.google.com/group/comp.lang.python/browse_thread/thread/32e545ebba11dd4d/49a9f0cc799cc1f1#49a9f0cc799cc1f1 -- http://mail.python.org/mailman/listinfo/python-list

Re: duplicate items in a list

2005-11-21 Thread Steven D'Aprano
On Mon, 21 Nov 2005 02:49:56 -0800, Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > a > [[1, 2], [1, 2], [2, 3]] noDups=[ u for u in a if u not in locals()['_[1]'] ] > Traceback (most recent call last): > File "", line

Re: duplicate items in a list

2005-11-21 Thread Daniel Schüle
Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > > a > > [[1, 2], [1, 2], [2, 3]] > noDups=[ u for u in a if u not in locals()['_[1]'] ] > > Traceback (most recent call last): > File "", line 1, in ? > TypeError: itera

Re: duplicate items in a list

2005-11-21 Thread Fredrik Lundh
Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > > >>> a > [[1, 2], [1, 2], [2, 3]] > >>> noDups=[ u for u in a if u not in locals()['_[1]'] ] > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argu

Re: duplicate items in a list

2005-11-21 Thread Fredrik Lundh
Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > > >>> a > [[1, 2], [1, 2], [2, 3]] > >>> noDups=[ u for u in a if u not in locals()['_[1]'] ] that's not portable, relies on CPython 2.4 implementation details, and shouldn't be used