[Python-Dev] More compact dictionaries with faster iteration

Dino Viehland dinov at microsoft.com
Tue Dec 11 20:37:13 CET 2012

PJ wrote:
> Actually, IronPython may already have ordered dictionaries by default; see:
>   http://mail.python.org/pipermail/ironpython-users/2006-
> May/002319.html
> It's described as an implementation detail that may change, perhaps that
> could be changed to being unchanging.  ;-)

I think this has changed since 2006.  IronPython was originally using the .NET
dictionary class and just locking while using it, but it now has a custom dictionary
which is thread safe for multiple readers and allows 1 writer.  But it doesn't do
anything to preserve order of insertions.

OTOH changing certain dictionaries in IronPython (such as keyword args) to be
ordered would certainly be possible.  Personally I just wouldn't want to see it
be the default as that seems like unnecessary overhead when the specialized
class exists.

More information about the Python-Dev mailing list