David Grant wrote:
> I find myself needing the set operations provided by python 2.4 such as
> intersection, difference, or even just the advantages of the data
> strucure itself, like that fact that I can try adding something to it
> and if it's already there, it won't get added again. Will my decision to
> use of the python 'set' datastructure come back to haunt me later by
> being too slow?
If you are adding stuff few items at a time to large sets, it is likely that
set() may be better for you O()-wise. However, the only way to know which
method
will be faster would be to try it yourself with your data.
> Is there anything equivalent in scipy or numpy that I
> can use? I find myself going between numpy arrays and sets a lot because
> I sometimes need to treat it like an array to use some of the array
> functions.
Robert Cimrman wrote a number of set operations (union, intersection,
difference) for arrays in numpy.lib.arraysetops . There have been some recent
discussions on improving them, especially in the face of inf, nan, and other
such floating point beasties.
> Sorry for cross-posting to scipy and numpy... is that a bad idea?
Yes. Please reserve cross-posting for announcements and other such things that
don't require follow-up discussions. Cross-posted discussions can get a bit
hairy. For questions like these ("Is there something in numpy or scipy to do
foo?"), there is enough cross-readership that it really doesn't matter if you
only ask one list.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/numpy-discussion