Ordering python sets
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Sun Oct 26 03:15:19 EDT 2008
On Sat, 25 Oct 2008 21:53:10 +0000, Lie Ryan wrote:
> Oh no, the two dict implementation would work _exactly_ the same from
> the outside, they are transparently interchangeable. Only the
> performance characteristic differs because of the different
> implementation.
They are not 100% interchangeably. Dictionaries as implemented need keys
to be hashable objects and sorted dictionaries need the keys to have an
order defined. So switching mapping types may fail unless the key
objects already have the needed magic methods implemented to do the right
thing.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list