4

I just wasted a good half hour trying to figure out why my Python dictionary was in alphabetical order.

I’ve had issues with dictionary order before with 3.5, but that was more or less Python just wanting to put shit in the order IT wants, not alphabetical. And I haven’t had that in months, not since updating to 3.6.

Long story short, VS Code has decided to show me my dictionaries in alphabetical order when I hover over them while stepping code. If I do a print statement, it shows the dictionary in the correct order.

Seriously, you don’t need to do me any favors here.

Oh, the adventures I have with Visual Studio when Python is involved...

Comments
  • 0
    As of 3.6/3.7, dictionaries DO have an order. It’s a dictionary of field information. This information is then split out into lists that need to be looped. The order of all of this matters.
  • 0
    @iHatePython As of 3.6, the dict remembering the order is just an implementation detail and not a feature. Hence if you are using 3.6, OrderedDict is still recommended.

    As of 3.7, it became a language feature though, so you can use it instead of OrderedDict.
  • 0
    @rithvikp Yes. I’m aware.
Add Comment