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

Paul Moore p.f.moore at gmail.com
Tue Dec 19 06:04:34 EST 2017


On 19 December 2017 at 08:27, Nathaniel Smith <njs at pobox.com> wrote:
> On Mon, Dec 18, 2017 at 11:38 PM, Steve Dower <steve.dower at python.org> wrote:
>> On 18Dec2017 2309, Steven D'Aprano wrote:
>>> [A LOT OF THINGS I AGREE WITH]
>> I agree completely with Steven's reasoning here, and it bothers me that
>> what is an irrelevant change to many users (dict becoming ordered) seems
>> to imply that all users of dict have to be updated.
>
> Can we all take a deep breath and lay off the hyperbole? The only
> point under discussion in this subthread is whether pprint -- our
> module for producing nicely-formatted-reprs -- should continue to sort
> keys, or should continue to provide an accurate repr. There are
> reasonable arguments for both positions, but no-one's suggesting
> anything in the same solar system as "all users of dict have to be
> updated".
>
> Am I missing some underlying nerve that this is hitting for some reason?

IMO, the key thing is that people appear to be talking as if changing
documented behaviour without deprecation is acceptable. Or even if
they are OK with a deprecation period, they are still talking about
changing documented behaviour for a trivial reason (as Steve Dower
said, most people will still use dict for its dict behaviour, not for
its orderedness). People (including me) are getting irritated because
backward compatibility, which is normally a key principle, is being
treated so lightly here. (It happened in another thread as well -
changing the output of csv.DictReader from OrderedDict to dict - again
suggesting that breaking a documented behaviour was OK, just because
dicts are now ordered).

Paul


More information about the Python-Dev mailing list