mathspp blog

408 443,826 37,138
articles words lines of code

Dip your toes in metaprogramming and learn about __init__'s big brother, the dunder method __new__.

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

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