[Tutor] Inheritance help

Jeff Younker jeff at drinktomi.com
Tue Jul 8 21:34:59 CEST 2008


> Hmm. I don't understand the LSP to make any requirements on the
> constructors. It says that instances of a subclass should be
> substitutable for instances of the base class, it doesn't say anthing
> how the instances are created.

Constructors as a separate language entity is an idea born of C++,
Java, etc.  In Python classes are first-class values and constructors
are (mostly) normal methods with a funky name, so the LSP applies
to them just like any other method in a class.

-jeff



More information about the Tutor mailing list