Python magic methods you haven’t heard about ↦
Python’s magic methods - also known as dunder (double underscore) methods - can be used to implement a lot of cool things. Most of the time we use them for simple stuff, such as constructors (
__init__), string representation (
__repr__) or arithmetic operators (
__mul__). There are however many more magic methods which you probably haven’t heard about and in this article we will explore all of them (even the hidden and undocumented).
Sign in or Join to comment or subscribe