David Hirschfield wrote: > Nothing's wrong with python's oop inheritance, you just need to know > that the parent class' __init__ is not automatically called from a > subclass' __init__. Just change your code to do that step, and you'll be > fine: > > class Parent( object ): > def __init__( self ): > self.x = 9 > > > class Child( Parent ): > def __init__( self ): > super(Child,self).__init__() > print "Inside Child.__init__()" > > -David >
How does it help that Parent.__init__ gets called? That call simply would create a temporary Parent object, right? I don't see how it should help (even though it *does* indeed work). Why do we need to pass self along in that call to super()? Shouldn't the class name be enough for super() to find the right superclass object? -- http://mail.python.org/mailman/listinfo/python-list