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

Paul G paul at ganssle.io
Tue Nov 7 15:35:54 EST 2017


If dictionary order is *not* guaranteed in the spec and the dictionary order isn't randomized (which I think everyone agrees is a bit messed up), it would probably be useful if you could enable "random order mode" in CPython, so you can stress-test that your code isn't making any assumptions about dictionary ordering without having to use an implementation where order isn't deterministic.

I could either be something like an environment variable SCRAMBLE_DICT_ORDER or a flag like --scramble-dict-order. That would probably help somewhat with the very real problem of "everyone's going to start counting on this ordered property".

On 11/07/2017 12:58 PM, Barry Warsaw wrote:
> On Nov 7, 2017, at 09:39, Paul Sokolovsky <pmiscml at gmail.com> wrote:
> 
>> So, the problem is that there's no "Python language spec”.
> 
> There is a language specification: https://docs.python.org/3/reference/index.html
> 
> But there are still corners that are undocumented, or topics that are deliberately left as implementation details.
> 
> Cheers,
> -Barry
> 
> 
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/paul%40ganssle.io
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171107/09130a6c/attachment.sig>


More information about the Python-Dev mailing list