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 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): > print "I am here!" > super(FileParse,self).__init__() > ... > ... > > You called the __init__ of FileParse's superclass(es), i.e. > object.__init__ > > What you wanted is this: > > class SinglePeakFit(FileParse): > ... > def __init___(self, filename): > print "I am here!" > super(SinglePeakFit,self).__init__() > ... > ... > > which calls the superclass(es) of SinglePeakFit, i.e. FileParse.__init__ > > Anyway, you don't actually need to use super() unless your class use > multiple inheritance. And even the en it is only really required if > there is 'diamond'-shaped inheritance, like: A(object), B(A), C(A), D(A, > B). But it is good practice to use super for any multiple inheritance, > even though it's not diamond shaped (actually all cases of multiple > inheritance is diamond shaped since all (new-style) classes inherits > from object). > > _______________________________________________ > Tutor maillist - [email protected] > http://mail.python.org/mailman/listinfo/tutor > > -- View this message in context: http://www.nabble.com/Inheritance-help-tp18240495p18242833.html Sent from the Python - tutor mailing list archive at Nabble.com. _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
