May-21-2018, 03:37 PM
Note that it's not sorted, but order-preserving. These are two different things. Also it is considered implementation details and should not be relied upon. So the iteration is "correct".
All that said are you certain you are using 3.6?
Quote:The order-preserving aspect of this new implementation is considered an implementation detail and should not be relied upon (this may change in the future, but it is desired to have this new dict implementation in the language for a few releases before changing the language spec to mandate order-preserving semantics for all current and future Python implementations; this also helps preserve backwards-compatibility with older versions of the language where random iteration order is still in effect, e.g. Python 3.5).
All that said are you certain you are using 3.6?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs