On 4/28/11 9:03 PM, gary ruben wrote:
> http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c
> i.e.
> dups = [x for x in list_a if list_a.count(x)>  1]

That involves iterating through your list_a a number of times to look 
for elements.  It probably would be much faster to use something like 
the Counter class to just get the items that occur once or more than once:

http://docs.python.org/library/collections.html#counter-objects

Thanks,

Jason


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to