Multiple inheritance, super() and changing signature

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Thu Jun 2 04:22:53 EDT 2016


On Wednesday, June 1, 2016 at 8:02:14 AM UTC+12, Ben Finney wrote:
> (Note that ‘__init__’ is not a constructor, because it operates on the
> *already constructed* instance, and does not return anything.

Believe it or not, that *is* what “constructor” means in every OO language. Technically it should be called the “initializer”, but “constructor” is the accepted term for the special method that is called to initialize a newly-allocated class instance.

> Python's classes implement the constructor as ‘__new__’, and you very rarely
> need to bother with that.)

Python’s “__new__” goes beyond the capabilities of “constructors” in conventional OO languages.


More information about the Python-list mailing list