Ordered dict by default
Paul Rubin
http
Thu Feb 5 05:28:04 EST 2009
Steve Holden <steve at holdenweb.com> writes:
> In mathematics mappings aren't ordered either, and a pure dict is pretty
> much a mapping. So leave them alone, they are fine as they are!
Ehhh, an ordered dict has to support a comparison operation on the
keys, while a Python dict has to support a hashing operation on them.
Neither really captures the idea of a pure mapping, which shouldn't
have to support any operations (even equality) on the keys.
There have been several times when I've wished for persistent ordered
dicts in Python. I started writing a big post about it a while ago
and maybe I'll finish it someday.
More information about the Python-list
mailing list