Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > Thomas Rachel wrote: > >> 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. > > Not nonsense. Merely a backward-incompatible change: > > > [steve@sylar ~]$ python2.2 > Python 2.2.3 (#1, Aug 12 2010, 01:08:27) > [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> object("two", "parameters") ><object object at 0x92a43e8> > > > In Python 2.2, the default object constructor accepts, and ignores, any > parameters. In Python 2.3 on up, that becomes an error. > More recently than that. It only became an error in 2.6:
[dbooth@localhost ~]$ python2.5 -c "object().__init__(42)" [dbooth@localhost ~]$ python2.6 -c "object().__init__(42)" Traceback (most recent call last): File "<string>", line 1, in <module> TypeError: object.__init__() takes no parameters -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list