Details about pythons set implementation

Arnaud Delobelle arnodel at
Fri Jan 4 18:37:41 CET 2008

On Jan 4, 5:08 pm, Sion Arrowsmith <si... at>
> 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....

This is really OT but IIRC, std::set<T> is actually
std::set< T, std::less<T> >

So make your own less_complex() function (for example, use
lexicographic order), std::set<complex, less_complex> should give you
a set of complex numbers (sorry if some syntax is incorrect I haven't
done any C++ for a while :)


More information about the Python-list mailing list