[Tutor] Inheritance : what am I doing wrong?

Emmanuel Ruellan eruellan@iFrance.com
Thu Nov 28 18:14:12 2002


Hello all,

I'm having a problem with inheritance. 
I'm trying to derive a class from the visual.sphere class, so
that I can add some methods. But I get an error message and I
can't figure out why.

What I do is:

    import visual

    class ball(visual.sphere):
        def __init__(self):
            visual.sphere.__init__(self, radius = 0.5)
            self.velocity = visual.vector(0, 0, 0)
        def fall(self, gravity):
            self.velocity.y += gravity
            self.pos += velocity

And I get the following error message:

    Traceback (most recent call last):
      File "<whatever>", line 3, in ?
        class ball(visual.sphere):
    TypeError: __init__() takes exactly 2 arguments (4 given)

Your help would be appreciated.

Regards,
Manu