I’ve had several use cases where insertion order in dictionaries mattered for me. I resorted to using OrderedDict collection but then I lost all the benefits of defaultdict.
I understand that there are still use cases for OrderDict, but I think it's dumb to make an implementation detail a part of the language specification.
Definitely not, ordering dicts by default gives at least two major advantages: (1) consistency in the iteration of items across all platforms and (2) consistency in the string representation of dictionaries. I have a feeling this change will silently cut down on a lot of headaches (at least until someone goes to run 3.7 code in an earlier version).
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.
10
u/weeeeezy Jun 28 '18
I’ve had several use cases where insertion order in dictionaries mattered for me. I resorted to using OrderedDict collection but then I lost all the benefits of defaultdict.