Hi Michael,

On Tue, Aug 16, 2011 at 2:06 PM, Michael Foord <fuzzy...@gmail.com> wrote:
> I assume the difference is that int has an __init__ method on pypy.

No, it doesn't; the issue is that the call int.__init__("12") is not
strictly equivalent to object.__init__("12").  It is on CPython, but
that's a bit by chance.  If you define your own Python classes like
this:

class MyObject(object):
    def __init__(self):
        pass
class MyInt(MyObject):
     pass

Then for an instance "o=MyObject()", the call MyInt.__init__(o) is not
equivalent to the call MyObject.__init__(o): indeed, the former fails
on CPython too, because MyInt.__init__ returns an unbound method
object attached specifically to MyInt.  In PyPy the same occurs even
with built-in types (because there is no type "built-in method" in
PyPy).


A bientôt,

Armin.
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to