[Python-Dev] Guarantee ordered dict literals in v3.7?
songofacandy at gmail.com
Thu Dec 14 21:03:42 EST 2017
TLDR, was the final decision made already?
If "dict keeps insertion order" is not language spec and we
continue to recommend people to use OrderedDict to keep
order, I want to optimize OrderedDict for creation/iteration
and memory usage. (See https://bugs.python.org/issue31265#msg301942 )
If dict ordering is language spec, I'll stop the effort and
use remaining time to another optimizations.
My thought is, +1 to make it language spec.
* PHP (PHP 7.2 interpreter is faster than Python) keeps insertion order.
So even we make it language spec, I think we have enough room
* It can make stop discussion like "Does X keeps insertion order?
It's language spec?", "What about Y? Z?". Everything on top of dict
keeps insertion order. It's simple to learn and explain.
INADA Naoki <songofacandy at gmail.com>
On Sun, Nov 5, 2017 at 3:35 AM, Guido van Rossum <guido at python.org> wrote:
> This sounds reasonable -- I think when we introduced this in 3.6 we were
> worried that other implementations (e.g. Jython) would have a problem with
> this, but AFAIK they've reported back that they can do this just fine. So
> let's just document this as a language guarantee.
> On Sat, Nov 4, 2017 at 10:30 AM, Stefan Krah <stefan at bytereef.org> wrote:
>> would it be possible to guarantee that dict literals are ordered in v3.7?
>> The issue is well-known and the workarounds are tedious, example:
>> If the feature is guaranteed now, people can rely on it around v3.9.
>> Stefan Krah
>> Python-Dev mailing list
>> Python-Dev at python.org
> --Guido van Rossum (python.org/~guido)
> Python-Dev mailing list
> Python-Dev at python.org
More information about the Python-Dev