Author aeros
Recipients Dima.Tisnek, aeros, docs@python, josh.r, lebigot, rhettinger
Date 2019-07-21.07:07:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1563692861.81.0.217702770008.issue30550@roundup.psfhosted.org>
In-reply-to
Content
>Thus, if a user gives an OrderedDict (or a dict with a known order, in Python 3.7+), it is useful that >he know that the order of its elements will not be changed upon transformation into JSON.

I would agree that it could be helpful to document that if a user passes an OrderedDict, the order of the elements will not changed, I was just pointing out that a default dictionary implementation would not normally retain the order. 

However, after looking through the 3.7 changes and reading the discussions, it looks like dictionaries retaining insertion order was decided to be made an official part of the language. If the order matters though, it would make sense to recommend users to use OrderedDict. The order in the default dictionary implementation can end up becoming sorted if pprint is used.

Discussions: https://mail.python.org/pipermail/python-dev/2017-December/151283.html and https://mail.python.org/pipermail/python-dev/2017-December/151376.html
History
Date User Action Args
2019-07-21 07:07:41aerossetrecipients: + aeros, rhettinger, lebigot, docs@python, Dima.Tisnek, josh.r
2019-07-21 07:07:41aerossetmessageid: <1563692861.81.0.217702770008.issue30550@roundup.psfhosted.org>
2019-07-21 07:07:41aeroslinkissue30550 messages
2019-07-21 07:07:41aeroscreate