Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Using OrderedDict in Python (Summary)

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 and dict
  • What the pros and cons are of using OrderedDict vs dict

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.

In this course, you coded an example of how to implement a dictionary-based queue, which is a use case that shows that OrderedDict can still be of value in your daily Python coding adventures.

To continue your learning or review foundational concepts, check out:

Download

Sample Code (ZIP)

938 bytes
Download

Course Slides (PDF)

5.5 MB

Become a Member to join the conversation.