Problem with inheritance

Sverre sverreodegard at gmail.com
Fri Oct 21 04:07:09 EDT 2011


I have to classes a  and b


class a(object):
    def __init__(self,x):
        self.x = x
        self.build()

    def build(self):
        return

class b(a):
    def __init__(self,x):
        a.__init__(self,x)
        self.y = 0  # ???

    def build(self):
        # do something
        self.y += 2*self.x

 t = b(1)

The line marked with "???" will no be executed and I don't know the
reason. This example is working as intended, but not not the code I'm
working on. I'm using Eclipse. I don't know how to debug this
problem.




More information about the Python-list mailing list