3 ms·
> Word to the wise... as of Python 3.7, the regular dictionary data structure guarantees order. Which means you still should use it if you might run on 3.6 or
by dataflow 2y ago
> Word to the wise... as of Python 3.7, the regular dictionary data structure guarantees order.
Which means you still should use it if you might run on 3.6 or earlier.
- sestep 2y agoEven for 3.6 it's still true, just not guaranteed in writing: https://stackoverflow.com/a/39980744/5044950 https://stackoverflow.com/a/39980744/5044950 And Python <=3.7 is already end-of-life anyways: https://devguide.python.org/versions/ https://devguide.python.org/versions/
- Helmut10001 2y agoThis hit me bad once bad. I tested the regular dict and it _looked_ like it was ordered. Turned out, 1 out of about 100000 times it was not. And I had a lot of trouble identifying the reason 3 weeks later, when the bug was buried deep in complex code, and it appeared mostly what looked like random.