Mathspp Blog

dunder methods β€” The dunder methods in Python

The dunder method __new__ is used to customise object creation and is a core stepping stone in understanding metaprogramming in Python.

This article shows how you can create a case-insensitive string class using some basic meta programming with the dunder method __new__.

This article shows how to implement the set built-in at the expense of a dictionary.

Explore what Python could look like if we got rid of all of its synthatic sugar.

Today I learned how to use the dunder method __init_subclass__ to be notified when a class is subclassed.

Learn how batched from the module itertools works, example use cases, and how to implement it.

This article shows you how to overload the arithmetic operators in Python with dunder methods.

Descriptors are not black magic and this article will show you that. In fact, you use descriptors every day and you don't even know it.

How do you implement a case-insensitive (or caseless) dictionary? In this article we explore solutions where we inherit from the built-in dict, the abstract base class MutableMapping from the standard module collections.abc, and the UserDict in the standard module collections.

This is a short and practical tutorial that guides you on how to work with case-insensitive strings in Python and teaches how to use the str.lower, str.upper, and str.casefold methods.

Learn about the dunder method __init__, responsible for initialising class instances.

This is an introduction to dunder methods in Python, to help you understand what they are and what they are for.