Python UserDict - Custom Python Dictionaries with collections Cover Image

Python UserDict – Custom Python Dictionaries with collections

Building custom dictionaries allows you to define powerful programs. You can easily build new dictionaries that have custom behavior or new functionalities, which build on top of regular Python dictionaries. In this tutorial, you’ll learn how to use the Python collections UserDict class to create custom dictionaries. You’ll also learn how to build your own […]

Python UserDict – Custom Python Dictionaries with collections Read More »

Collections ChainMaps in Python Complete Guide Cover Image

Collections ChainMaps in Python: Complete Guide

The Python collections module provides Python’s implementations of chain maps with the ChainMaps class. This allows you to implement multiple dictionaries in the same context. This means that you can maintain multiple dictionaries, but access them as though they were a single dictionary. In this tutorial, you’ll learn how to use the ChainMap class from

Collections ChainMaps in Python: Complete Guide Read More »

Python Collections OrderedDict - Adding Order to Dictionaries Cover Image

Python Collections OrderedDict: Adding Order to Dictionaries

Python OrderedDicts are dictionary subclasses that maintain the order of the items added to them. Since Python 3.6, dictionaries in Python have maintained order. So this begs the question, why do we still need the OrderedDict class from the Python collections module? By the end of this tutorial, you’ll have gained a strong understanding of

Python Collections OrderedDict: Adding Order to Dictionaries Read More »