All the Python dictionary implementations listed in this course are valid implementations that are built into the Python standard library.
If you’re looking for a general recommendation on which mapping type to use in your programs, I’d point you to the built-in dict
data type. It’s a versatile and optimized hash table implementation that’s built directly into the core language.
I would recommend that you use one of the other data types listed here only if you have special requirements that go beyond what’s provided by dict
. All the implementations are valid options, but your code will be clearer and easier to maintain if it relies on standard Python dictionaries most of the time.
Here are resources for documentation about dictionaries:
- Built-in Types:Mapping types – dict | Python Documentation
- collections – Container Datatypes: OrderedDict | Python Documentation
- collections – Container Datatypes: defaultdict | Python Documentation
- collections – Container Datatypes: ChainMap | Python Documentation
- types – Dynamic type creation and names for built-in types: MappingProxyType | Python Documentation
- Glossary: hashable | Python Documentation
Here are additional Real Python resources about dictionaries: