I'm learning about OrderedDicts in python but when I create new dictionaries it preserves the order anyway. I can't seem to find a good example of why you'd ever need to use an OrderedDict.
For reference, if I do this:
x = {"one":1,"two":2,"three":3}
print(x)
it will always print out {'one': 1, 'two': 2, 'three': 3}
I'm just looking to understand why we need OrderedDicts.
I'm learning about OrderedDicts in python but when I create new dictionaries it preserves the order anyway.
This is accidentally the case with python 3.6 It is an implementation detail. See Dictionaries are ordered in Python 3.6+
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.