For years, Python dictionaries were unordered data structures. This revealed the need for an ordered dictionary that helps in situations where the order of items is important. So Python developers created OrderedDict
, which was specially designed to keep its items ordered.
Python 3.6 introduced a new feature into regular dictionaries. Now they also remember the order of items. With this addition, most Python programmers wonder if they still need to consider using OrderedDict
.
In this video course, you learned:
- How to create and use
OrderedDict
objects in your code - What the main differences are between
OrderedDict
anddict
- What the pros and cons are of using
OrderedDict
vsdict
Now you’re in a better position to make an educated decision on whether to use dict
or OrderedDict
if your code needs an ordered dictionary.