class A: def new(cls, *args, **kwargs): print("Creating instance of A") return super().new(cls) def init(self): print("Initializing A") class B(A): def new(cls, *args, **kwargs): print("Creating instance of B") return super().new(cls) def init(self): print("Initializing B") obj = B()