Details about pythons set implementation

Sion Arrowsmith siona at chiark.greenend.org.uk
Fri Jan 4 12:08:23 EST 2008


Hrvoje Niksic  <hniksic at xemacs.org> wrote:
>BTW if you're using C++, why not simply use std::set?

Because ... how to be polite about this? No, I can't. std::set is
crap. The implementation is a sorted sequence -- if you're lucky,
this is a heap or a C array, and you've got O(log n) performance.
But the real killer is that requirement for a std::set<T> is that
T::operator< exists. Which means, for instance, that you can't
have a set of complex numbers....

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list