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__
.
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
.