7 ms·
> The same issue occurred in python. And now, as predicted by core developer Raymond Hettinger in his Modern Dictionaries talk, Python's dicts are now guarante
by Rendello 5y ago
> The same issue occurred in python.
And now, as predicted by core developer Raymond Hettinger in his Modern Dictionaries talk, Python's dicts are now guaranteed to be ordered by default (as of 3.7).
- randomswede 5y agoThat makes me sad.
- xsmasher 5y agoCurious why? Clearly this is a landmine that many people step on. Why not remove it?
- asdfasgasdgasdg 5y agoTo the extent this creates a performance penalty, it's a little annoying that a few systems create a behavior dependency that is not truly needed in a core type when there is a separate type that implements the desired semantics. But then again if it doesn't make it slower it should be fine.
- Rendello 5y agoFwiw, the way Raymond re-implemented dictionaries made them more efficient (the algorithms are the same, but it's now much more cache friendly), and had the side effect of making them ordered. He and many others advocated for having the ordering guaranteed going forward.
- randomswede 5y agoAnd now they're locked into an implementation that is order-preserving, even if an optimization tomorrow could eke out another 10%, if ordering was not guaranteed.