1
Vote

object.__new__() takes no parameters - unexcpected __init__ considered

description

I have spotted difference between IronPython and cpython. It has to do with calling of the init in superclasses when multiple inheritance is used. In the test case below IronPython insist on calling init where cpython doesn't.
 
class OldStyle:
def __init__(self, arg):
    print "OldStyle"
 
class NewStyleNoInit1(OldStyle,object):
pass
 
NewStyleNoInit1(0)
 
IronPython prints:
Traceback (most recent call last):
File "xx.py", line 8, in <module>
TypeError: object.__new__() takes no parameters
 
CPython prints:
OldStyle

file attachments

comments