How does `object.__init__` behave regarding arguments in Python 3?

Python interview question for Advanced practice.

Answer

It raises TypeError if arguments are passed, unless the class does NOT override new and only inherits init

Explanation

object.init ignores arguments if the class overrides new or init to accept them. But if object.init is reached with args because you didn't override things correctly or called super().init(args), it raises TypeError.

Related Questions