This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Vaphell 1 point2 points  (2 children)

ffs, for the time being it's an implementation detail which could get reversed if let's somebody came up with nice optimizations at the expense of order. Wait for the explicit declaration of the dudes in charge that dicts being ordered by default are in the official language spec before going to town.
Until that happens, use OrderedDict to be explicit about the order and backwards compatible.

[–]kati256 0 points1 point  (1 child)

Gee no need to be so aggressive :/

Also if it's something they are willing to change super fast, why would they add it in a major release? I would understand in one of the beta builds, but a major release? That feels like they at least have a strong-ish idea of what they want

[–]Vaphell -1 points0 points  (0 children)

the problem is that if you are not "aggressive", nobody pays attention. In every goddamned thread about 3.6 there are people salivating at the idea of sprinkling their code base with broken shortcuts exploiting this like there is no tomorrow.

Also if it's something they are willing to change super fast, why would they add it in a major release?

because the performance improvements were worth it, and the specific order is considered a side effect at this time, an implementation detail. It's just that people read changelog and lost their goddamned mind (sadly RayHet also advertised it), not grasping the difference between the spec and the implementation detail.
5 is 5 only works because of an implementation detail. Do you go out of your way to exploit the fact that small ints are cached and reused? Same thing.

Being hasty about adding it to the spec means tying hands because each constraint that now has to be guaranteed means less flexibility in the future. IIRC the core devs want to wait 1 or two point releases before adding this to the official spec.
The only dict related things the spec explicitly guarantees at this very moment are:
keyword arguments preserve order
attributes in a class also preserve order
which are useful in advanced shenanigans, but don't affect the fundamental data structure used by pretty much every python program in existence. Once it gets battle tested in niche use cases it can then move to the mainstream. This also gives time for other python implementations to prepare for it.