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

Guido van Rossum guido at python.org
Fri Dec 22 19:12:31 EST 2017


Let's not change pprint.

On Fri, Dec 22, 2017 at 7:44 AM, Eric Fahlgren <ericfahlgren at gmail.com>
wrote:

> On Thu, Dec 21, 2017 at 7:51 PM, Stephen J. Turnbull <
> turnbull.stephen.fw at u.tsukuba.ac.jp> wrote:
>
>> I understand the motivation to guarantee order, but it's a programmer
>> convenience that has nothing to do with the idea of mapping, and the
>> particular (insertion) order is very special and usually neither
>> relevant nor reproducible.  I have no problem whatsoever with just
>> documenting any failure to preserve order while reproducing dicts,
>> *except* that a process that inserts keys in the same order had better
>> result in the same insertion order.
>>
>
> ​json, pickle == png, i.e., guaranteed lossless.
> repr, pprint == jpg, lossy for very specific motivating reasons.​
>
> In particular, I use pprint output in regression baselines, and if the
> long documented sort-by-key behavior changed, I would not be happy.
>
> _______________________________________________
> 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/
> guido%40python.org
>
>


-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171222/2ce49d31/attachment.html>


More information about the Python-Dev mailing list