[Tutor] inheritance and super() function in python

Jorge Leon jorge.a.leon.g at gmail.com
Tue Apr 22 15:48:51 CEST 2014

Good day,

I have programmed a base class for an environment I have with no problem,
but when it comes to referencing the base class's constructor in the
derived class's constructor I have been getting errors:

*TypeError: Error when calling the metaclass bases*
*    module.__init__() takes at most 2 arguments (3 given)*

Here's how my base class' constructor looks like (position =  [x, y, z]):
*class Obstacle:*
*    def __init__(self,position):*
*        self.position = position*

Here's how my derived class's constructor looks like

*class Cylinder(Obstacle):*
*   def __init__(self,position, height, radius):*
*       super(Obstacle,self).__init__(position)*

I have no idea where the 3 given arguments are being taken from. I have
modified the code on the super line just in case I missed something but
that has not changed a thing. I have read that in Python you may be able to
double reference, but there are no other classes interfacing the base and
derived class.

If anyone has had some prior experience with this I'd appreciate your


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140422/79fb8edd/attachment.html>

More information about the Tutor mailing list