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
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev