[Python-Dev] The current dict is not an "OrderedDict"

Cameron Simpson cs at cskk.id.au
Thu Nov 9 16:46:23 EST 2017


On 08Nov2017 10:28, Antoine Pitrou <solipsis at pitrou.net> wrote:
>On Wed, 8 Nov 2017 13:07:12 +1000
>Nick Coghlan <ncoghlan at gmail.com> wrote:
>> On 8 November 2017 at 07:19, Evpok Padding <evpok.padding at gmail.com> wrote:
>> > On 7 November 2017 at 21:47, Chris Barker <chris.barker at noaa.gov> wrote:
>> >> if dict order is preserved in cPython , people WILL count on it!
>> >
>> > I won't, and if people do and their code break, they'll have only themselves
>> > to blame.
>> > Also, what proof do you have of that besides anecdotal evidence ?
>>
>> ~27 calendar years of anecdotal evidence across a multitude of CPython
>> API behaviours (as well as API usage in other projects).
>>
>> Other implementation developers don't say "CPython's runtime behaviour
>> is the real Python specification" for the fun of it - they say it
>> because "my code works on CPython, but it does the wrong thing on your
>> interpreter, so I'm going to stick with CPython" is a real barrier to
>> end user adoption, no matter what the language specification says.
>
>Yet, PyPy has no reference counting, and it doesn't seem to be a cause
>of concern.  Broken code is fixed along the way, when people notice.

I'd expect that this may be because that would merely to cause temporary memory 
leakage or differently timed running of __del__ actions.  Neither of which 
normally affects semantics critical to the end result of most programs.

However, code which relies on an ordering effect which works in the usual case 
but (often subtly) breaks in some unusual case can be hard to debug, because 
(a) recognising the salient error situation may be hard to do and (b) reasoning 
about the failure is difficult when the language semantics are not what you 
thought they were.

I think the two situations are not as parallel as you think.

Cheers,
Cameron Simpson <cs at cskk.id.au> (formerly cs at zip.com.au)


More information about the Python-Dev mailing list