Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #13006

Re: TypeError: object.__init__() takes no parameters

From Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de>
Newsgroups comp.lang.python
Subject Re: TypeError: object.__init__() takes no parameters
Date 2011-09-09 08:57 +0200
Organization A newly installed InterNetNews server
Message-ID <j4cdda$f61$1@r03.glglgl.eu> (permalink)
References <e4d24c0f-3556-420d-bfed-4b14927d35a4@v16g2000prb.googlegroups.com>

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

TypeError: object.__init__() takes no parameters Oliver <wildeskraut@googlemail.com> - 2011-09-08 22:47 -0700
  Re: TypeError: object.__init__() takes no parameters Ben Finney <ben+python@benfinney.id.au> - 2011-09-09 16:44 +1000
  Re: TypeError: object.__init__() takes no parameters Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-09-09 08:57 +0200
    Re: TypeError: object.__init__() takes no parameters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-09 18:33 +1000
      Re: TypeError: object.__init__() takes no parameters Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-09-09 11:11 +0200
      Re: TypeError: object.__init__() takes no parameters Duncan Booth <duncan.booth@invalid.invalid> - 2011-09-09 13:20 +0000
        Re: TypeError: object.__init__() takes no parameters Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-09 23:41 +1000
    Re: TypeError: object.__init__() takes no parameters Duncan Booth <duncan.booth@invalid.invalid> - 2011-09-09 09:49 +0000
  Re: TypeError: object.__init__() takes no parameters Terry Reedy <tjreedy@udel.edu> - 2011-09-09 13:31 -0400

csiph-web