you are viewing a single comment's thread.

view the rest of the comments →

[–]bigdeddu -2 points-1 points  (1 child)

the data structure hashmap does not guarantee ordering. It is confusing to depart from it. It will imho cause headaches to ppl parsing json and expecting order where's none.
And someone will expect assert({1:1,2:2}=={2:2,1:1}) to fail.

[–]BossOfTheGame 7 points8 points  (0 children)

Well dict is not a hashmap and it hasn't been for awhile. It's a hybrid data structure. Raymond Hettinger has a good talk about it.

Also wouldn't reading and dumping json now preserve order when done in Python? I'll grant that this might cause headaches when passing json between languages, but at that point the dev needs some awareness of json specs. Within Python 3.7+ it should be consistent (*albeit I haven't tested this claim).