Re: [Tutor] Inheritance help

2008-07-08 Thread Jeff Younker
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++, Jav

Re: [Tutor] Inheritance help

2008-07-03 Thread Alan Gauld
"Kent Johnson" <[EMAIL PROTECTED]> wrote 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. LSP doesn't distinguish

Re: [Tutor] Inheritance help

2008-07-02 Thread Kent Johnson
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 questi

Re: [Tutor] Inheritance help

2008-07-02 Thread Alan Gauld
"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 th

Re: [Tutor] Inheritance help

2008-07-02 Thread sean_mcdaniel
Hi y'all, I found the problem. My __init__ statement in the subclass had an extra underscore, which is why the baseclass __init__ was the only one called. Duh! Sean sean_mcdaniel wrote: > > Thank you for the reply. > > I have made the substitution, but I still receive the same error. I > pr

Re: [Tutor] Inheritance help

2008-07-02 Thread sean_mcdaniel
Thank you for the reply. I have made the substitution, but I still receive the same error. I previously defined the __init__ statements in the old way, i.e. FileParse.__init__(self) but with the same problematic outcome. Thank you, Sean Lie Ryan wrote: > >> Hi Folks, >> >> I can redefine

Re: [Tutor] Inheritance help

2008-07-02 Thread Lie Ryan
> Hi Folks, > > I can redefine the class and I get a "TypeError: __init__() takes > exactly 1 > argument (2 given)" error. I'm creating a SinglePeakFit object and > not a > FileParse one. Still puzzled... In this: class SinglePeakFit(FileParse): ... def __init___(self, filename):

[Tutor] Inheritance help

2008-07-02 Thread sean_mcdaniel
Hi folks, I am having problems with classes and subclasses. Do the different __init__ statements have to have different argument lists? I expected my code to print out "location 1" and "location 2" indicating that both __init__ statements had been successfully called, but it seems like only the s

Re: [Tutor] Inheritance help

2008-07-02 Thread sean_mcdaniel
Hi Folks, I can redefine the class and I get a "TypeError: __init__() takes exactly 1 argument (2 given)" error. I'm creating a SinglePeakFit object and not a FileParse one. Still puzzled... Thanks, Sean New definition: """Contains various classes for parsing input files. Used for various fi