2 ms·
That definitely was true, and I use to jitter my code a little to deliberately find and break tests that depended on any particular ordering. It's now explicit
by kstrauser 2y ago
That definitely was true, and I use to jitter my code a little to deliberately find and break tests that depended on any particular ordering.
It's now explicitly documented to be true, and you can officially rely on it. From https://docs.python.org/3/library/stdtypes.html#dict https://docs.python.org/3/library/stdtypes.html#dict:
> Changed in version 3.7: Dictionary order is guaranteed to be insertion order.
That link documents the Python language's semantics, not the behavior of any particular interpreter.