You only need to override the methods you want to change.
In other words:
If you do not override __init__ , the __init__ method of the superclass is called.
eg.
class Bag: pass
if equivalent:
class Bag: def __init__(self): super(Bag, self).__init__()
In addition, __init__ indeed optional. This is the initializer for the instance .
When you create an instance of the class (by calling it), the constructor for the class is called (class method __new__ ). The constructor returns the instance for which __init__ is called.
So in practice even:
class Bag: def __init__(self): pass
Will work fine.
source share