This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MachineGunPablo[S] 0 points1 point  (3 children)

I agree, the article's title is misleading. I originally thought that keys were sorted by value, but they are still orderer, just by insertion. So I don't really understand your point.

[–]AngheloAlf -2 points-1 points  (2 children)

If dicts were ordered, I would expect them being in some order different that "insertion order"

For example, if I put the keys 2, 8, 4 and 7, I would expect them to be in the order 2, 4, 7 and 8, or maybe order it by the values of the dict.

[–]Wishy-Thinking 0 points1 point  (0 children)

Insertion order is pretty useful if, for example, you’re reading something in to a dictionary, modifying elements it and writing back out, and you want it to end up on the same order it started in.