Why are there no ordered dictionaries?
Christoph Zwerschke
cito at online.de
Wed Nov 23 17:39:22 EST 2005
Carsten Haese schrieb:
> Thus quoth the Zen of Python:
> "Explicit is better than implicit."
> "In the face of ambiguity, refuse the temptation to guess."
>
> With those in mind, since an odict behaves mostly like a dictionary, []
> should always refer to keys. An odict implementation that wants to allow
> access by numeric index should provide explicitly named methods for that
> purpose.
Exactly. But I don't think in this case such methods would be needed.
You easily get the i-th value in the ordered dict as d.values()[i].
-- Chris
More information about the Python-list
mailing list