Dunder (derived from double underscore) methods are special/magic predefined methods in Python, with names that start and end with a double underscore. There’s nothing really magical about them. Examples of these include:
__init__
– constructor__str__
,__repr__
– object representation (casting to string, printing)__len__
,__next__
… – generators__enter__
,__exit__
– context managers__eq__
,__lt__
,__gt__
– operator overloading