4 ms·
> Dictionaries preserve order in Python. This ship sailed a long time ago. That ship only sailed last December with the release of 3.6. It is only an implemen
by kevin_thibedeau 9y ago
> Dictionaries preserve order in Python. This ship sailed a long time ago.
That ship only sailed last December with the release of 3.6. It is only an implementation detail for CPython. Other implementations can and will use the old behavior. Nobody should be writing code that depends on this behavior.
- alphaalpha101 9y agoRealistically other implementations of Python aren't relevant. Saying you shouldn't write code assuming dict preserves order is like saying you shouldn't write code that uses numpy or other CPython-only libraries, isn't it?