<div>cPython 2.6.6 is able to initialize subclassed int-objects from strings:</div><div><br></div><div>Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on</div><div>win32</div><div>Type "help", "copyright", "credits" or "license" for more information.</div>
<div>>>> class fisch(int):</div><div>... def __init__(self, value):</div><div>... int.__init__(value)</div><div>...</div><div>>>> a=fisch("12")</div><div>>>></div><div><br>
</div><div><br></div><div>pypy 1.5.0 is not able to do this:</div><div><br></div><div>Python 2.7.1 (aefc70438132+, Apr 29 2011, 12:45:42)</div><div>[PyPy 1.5.0-alpha0 with MSC v.1600 32 bit] on win32</div><div>Type "help", "copyright", "credits" or "license" for more information.</div>
<div>And now for something completely different: ``topics are for the feeble</div><div>minded''</div><div>>>>> class fisch(int):</div><div>.... def __init__(self, value):</div><div>.... int.__init__(value)</div>
<div>....</div><div>>>>> a=fisch("12")</div><div>Traceback (most recent call last):</div><div> File "<console>", line 1, in <module></div><div> File "<console>", line 3, in __init__</div>
<div>TypeError: unbound method __init__() must be called with int instance as first a</div><div>rgument (got str instance instead)</div><div><br></div><div><br></div><div>(detected this behavior difference when trying to pypy pyPdf)</div>
<div><br></div><div>why is this?</div><div><br></div><div>Harald</div><div>-- </div>GHUM GmbH<br>Harald Armin Massa<br>Spielberger Straße 49<br>70435 Stuttgart<br>0173/9409607<br><br>Amtsgericht Stuttgart, HRB 734971<br>-<br>
persuadere.<br>et programmare<br>