[pypy-dev] behaviour difference int-subclasses pypy 1.5 to cpython 2.6.6.
Armin Rigo
arigo at tunes.org
Tue Aug 16 13:16:14 CEST 2011
Hi,
On Tue, Aug 16, 2011 at 11:59 AM, Massa, Harald Armin <chef at ghum.de> wrote:
>>>> class fisch(int):
> ... def __init__(self, value):
> ... int.__init__(value)
You probably mean "int.__init__(self, value)" here. Your code is buggy :-)
It works on CPython anyway, which is a bit strange in my opinion, but
probably comes from the fact that the 'int' class has no attribute
'__init__', and "int.__init__" just returns the exact same object as
"object.__init__". On PyPy instead, you get a regular unbound method,
which checks that it is passed a first argument of the correct class.
A bientôt,
Armin.
More information about the pypy-dev
mailing list