[Python-Dev] The current dict is not an "OrderedDict"

Antoine Pitrou solipsis at pitrou.net
Tue Nov 7 10:12:42 EST 2017

On Wed, 8 Nov 2017 01:56:42 +1100
Steven D'Aprano <steve at pearwood.info> wrote:
> I think that Nick's intent was not to say that after a single deletion, 
> the ordering guarantee goes away "forever", but that a deletion may be 
> permitted to reorder the keys, after which further additions will honour 
> insertion order. At least, that's how I interpret him.

The problem is this is taking things to a level of precision that makes
the guarantee tedious to remember and reason about.

The only thing that's friendly to (non-expert) users is either "dicts
are always ordered [by insertion order], point bar" or "dicts are not
ordered, point bar".  Anything in-between, with reservations depending
on which operations are invoked and when, is not really helpful to the
average (non-expert) user.

Which is why I think the user-friendliness argument does not apply if
order ceases to be guaranteed after __del__ is called.



More information about the Python-Dev mailing list