On Wed, Jul 2, 2008 at 9:05 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > "sean_mcdaniel" <[EMAIL PROTECTED]> wrote > >> I am having problems with classes and subclasses. Do the different >> __init__ >> statements have to have different argument lists? > > You got the solution to your specific question but to answer > your more pholosophical one: > > sub classes should ideally have the same signature as their > superclass (the Liskov Substitution Principle or LSP). In other > words you should be able to plug a sub class in anywhere that the > superclass can be used. > > This implies that depending on language provisions) your > sub class should have > > a) one constructor with the same signature as the superclass
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. BTW those wondering what we are talking about might be interested in this paper: http://objectmentor.com/resources/articles/lsp.pdf Kent _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
