[Python-ideas] Let's be more orderly!

Andrew Barnert abarnert at yahoo.com
Wed May 15 00:23:26 CEST 2013

On May 14, 2013, at 12:53, Jonathan Eunice <jonathan.eunice at gmail.com> wrote:

> Using a compatible, separate implementation for OrderedDict is a fine way to gracefully extend the language, but it leaves ordering only half-accomodated. Consider:
> OrderedDict(a=2, b=3, c=7)
If your proposal is to replace dict with OrderedDict, I think you need at least one use case besides OrderedDict's constructor.
> But from an app developer’s point of view, ordering is a basic, essential property.
There are plenty of things that are basic, essential properties of a particular type, but there is very little that's a basic, essential property of _all_ types.

Surely you wouldn't suggest that a complex number should remember whether you specified the real or imaginary component first.

So your argument is that order of insertion is a basic property of _mappings_ in particular.

And I think blist.sorteddict, trie.Trie, etc. are good arguments against even that assertion. It's not just about performance; it's about correctness. Insertion order is not a fundamental property of mappings.

If you're just suggesting that collections.abc should grow an OrderedMapping, and/or that kwargs should be an OrderedDict, either or both might be reasonable.

But if you're suggesting that Mapping and dict should both become ordered, I disagree with both. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130514/f3bfbbca/attachment.html>

More information about the Python-ideas mailing list