[Pythonmac-SIG] Fast way to get a list of unique values?
Bob Ippolito
bob@redivi.com
Mon, 9 Sep 2002 17:03:07 -0400
The only ways I know of doing this in python are to use a for loop..
either creating a dictionary with keys set to those values, or sorting
the list and making the new list from the first time you see a
particular element. Unless I'm mistaken, trying to hack it out any
other way (without breaking out a C compiler) would be much slower.
-bob
On Monday, Sep 9, 2002, at 16:48 US/Eastern, Robb Brown wrote:
>
> I have a large array (Numeric) of integers. I'd like to get a list of
> all the unique values in that array. Naturally I'd like to avoid a
> for loop. Is there an easy way to do this in Python?
>
> Thanks,
>
> Robb