U
Ulrich Eckhardt
Hi!
Preparing for an upgrade from 2.7 to 3, I stumbled across an
incompatibility between 2.7 and 3.2 on one hand and 3.3 on the other:
class X(int):
def __init__(self, value):
super(X, self).__init__(value)
X(42)
On 2.7 and 3.2, the above code works. On 3.3, it gives me a "TypeError:
object.__init__() takes no parameters". To some extent, this makes sense
to me, because the int subobject is not initialized in __init__ but in
__new__. As a workaround, I can simple drop the parameter from the call.
However, breaking backward compatibility is another issue, so I wonder
if that should be considered as a bug.
Bug? Feature? Other suggestions?
Uli
Preparing for an upgrade from 2.7 to 3, I stumbled across an
incompatibility between 2.7 and 3.2 on one hand and 3.3 on the other:
class X(int):
def __init__(self, value):
super(X, self).__init__(value)
X(42)
On 2.7 and 3.2, the above code works. On 3.3, it gives me a "TypeError:
object.__init__() takes no parameters". To some extent, this makes sense
to me, because the int subobject is not initialized in __init__ but in
__new__. As a workaround, I can simple drop the parameter from the call.
However, breaking backward compatibility is another issue, so I wonder
if that should be considered as a bug.
Bug? Feature? Other suggestions?
Uli