integer subclass range behavior

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Dec 19 19:42:25 EST 2007


En Wed, 19 Dec 2007 18:11:49 -0300, josepharmbruster at gmail.com  
<josepharmbruster at gmail.com> escribió:

> I was wondering what would happen, so I tried this out for the heck of
> it with:
> Python 3.0a2 (py3k:59572M, Dec 19 2007, 15:54:07) [MSC v.1500 32 bit
> (Intel)] on win32
>
> class a(int):
>   def __new__(cls,number):
>     return int.__new__(cls,number)
>
> for x in range(0,a(5)):
>   print(x)
>
>
> Which resulted in a:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "a.py", line 5, in <module>
>     for x in range(0,a(5)):
> SystemError: .\Objects\longobject.c:400: bad argument to internal
> function
>
> Interesting!

Yes. But much more interesting would be to report this on the bug tracker  
http://bugs.python.org else it will fade away...

-- 
Gabriel Genellina




More information about the Python-list mailing list