Re: [Python-Dev] Guarantee ordered dict literals in v3.7?

2017年12月14日 18:06:50 -0800

Hi, folks.
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
 to optimize.
* 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.
Regards,
INADA Naoki <[email protected]>
On Sun, Nov 5, 2017 at 3:35 AM, Guido van Rossum <[email protected]> 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 <[email protected]> wrote:
>>
>>
>> Hello,
>>
>> 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:
>>
>>
>> https://mail.python.org/pipermail/python-ideas/2015-December/037423.html
>>
>>
>> If the feature is guaranteed now, people can rely on it around v3.9.
>>
>>
>>
>> Stefan Krah
>>
>>
>>
>> _______________________________________________
>> Python-Dev mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>
>
>
>
> --
> --Guido van Rossum (python.org/~guido)
>
> _______________________________________________
> Python-Dev mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/songofacandy%40gmail.com
>
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to