[pypy-dev] behaviour difference int-subclasses pypy 1.5 to cpython 2.6.6.
Massa, Harald Armin
chef at ghum.de
Tue Aug 16 11:59:59 CEST 2011
cPython 2.6.6 is able to initialize subclassed int-objects from strings:
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class fisch(int):
... def __init__(self, value):
... int.__init__(value)
...
>>> a=fisch("12")
>>>
pypy 1.5.0 is not able to do this:
Python 2.7.1 (aefc70438132+, Apr 29 2011, 12:45:42)
[PyPy 1.5.0-alpha0 with MSC v.1600 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``topics are for the feeble
minded''
>>>> class fisch(int):
.... def __init__(self, value):
.... int.__init__(value)
....
>>>> a=fisch("12")
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "<console>", line 3, in __init__
TypeError: unbound method __init__() must be called with int instance as
first a
rgument (got str instance instead)
(detected this behavior difference when trying to pypy pyPdf)
why is this?
Harald
--
GHUM GmbH
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
Amtsgericht Stuttgart, HRB 734971
-
persuadere.
et programmare
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110816/c90ae48e/attachment.html>
More information about the pypy-dev
mailing list