Why are there no ordered dictionaries?
Christoph Zwerschke
cito at online.de
Wed Nov 23 15:17:20 EST 2005
Bengt Richter wrote:
> I think the concept has converged to a replace-or-append-by-key ordering
> of key:value items with methods approximately like a dict. We're now
> into usability aspects such as syntactic sugar vs essential primitives,
> and default behaviour vs selectable modes, ISTM.
Yes, and we would be good if we do not stop the discussion at this point
with nothing, but really create such a sophisticated implementation.
Whether it will become popular or go to the standard lib some day is a
completely different question.
> E.g., it might be nice to have a mode that assumes d[key] is
d.items()[k][1] when
> key is an integer, and otherwise uses dict lookup, for cases where
the use
> case is just string dict keys.
I also thought about that and I think PHP has that feature, but it's
probably better to withstand the temptation to do that. It could lead to
an awful confusion if the keys are integers.
-- Christoph
More information about the Python-list
mailing list