Problem with inheritance

Sverre sverreodegard at gmail.com
Fri Oct 21 04:16:58 EDT 2011


On Oct 21, 10:07 am, Sverre <sverreodeg... at gmail.com> wrote:
> 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.

I found the solution. I caused an exception in b.build that wasn't
reported by Eclipse properly.



More information about the Python-list mailing list