Selecting the Right Dictionary for the Job
00:00
Selecting the Right Dictionary for the Job. So far, you’ve learned about the subtle differences between OrderedDict
and dict
. You’ve learned that, even though regular dictionaries have been ordered data structures since Python 3.6, there is still some value in using OrderedDict
because of a set of useful features that aren’t present in standard dictionaries.
00:21 On-screen is a summary of the more relevant differences and features of both classes that you should consider when you’re deciding which one to use.
00:30
This summarizes some of the main differences between OrderedDict
and dict
that you should consider when you need to choose a dictionary class to solve a problem or to implement a specific algorithm. In general, if the order of items in the dictionary is vital or even important for your code to work correctly, then your first look should be towards OrderedDict
.
00:53 In the next section of the course, you’ll take a look at one such situation, building a dictionary-based queue.
Become a Member to join the conversation.