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]'] ]

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 (

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)

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 C

duplicate items in a list

2005-11-21 Thread Shi Mu
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 ? TypeErro