TypeError: object.__init__() takes no parameters

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Fri Sep 9 08:57:31 CEST 2011


Am 09.09.2011 07:47 schrieb Oliver:
> class Container(object):
>      """Container to store  a number of non-overlapping rectangles."""
>      def __init__(self, xsize=1200, ysize=800):
>          super(Container, self).__init__(xsize, ysize)

And this is the nonsense: Container derives from object and tries to 
call its superclass's constructor with 2 parameters - which won't work.

Write this as super(Container, self).__init__().

HTH,

Thomas



More information about the Python-list mailing list