The collections module in Python, provides solutions for multiple scenarios, that would be otherwise tricky to implement.

Let’s see how the abstractions this module provides, come in handy when dealing with different kinds of problems.

Extending built-in Types

Sometimes you need an object that behaves exactly like a built-in type of Python, but you would like to also extend some behaviour of it. For this, the most common approach is to directly subclass the type.

For example, let’s imagine a fictional event system, on which we model our events as dictionaries, and we’d like to have some extra meta-data over the events. …

Mariano Anaya

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store