On 9/15/07, Carl Banks <[EMAIL PROTECTED]> wrote: > On Fri, 14 Sep 2007 22:59:13 -0300, Eduardo O. Padoan wrote: > > > On 14 Sep 2007 18:08:00 -0700, Paul Rubin > > <"http://phr.cx"@nospam.invalid> wrote: > >> "Eduardo O. Padoan" <[EMAIL PROTECTED]> writes: > >> > Not totally unrelated, but in Py3k, as it seems, overflows are really > >> > things of the past: > >> > > >> > > >> > Python 3.0a1 (py3k:58061, Sep 9 2007, 13:18:37) [GCC 4.1.3 20070831 > >> > (prerelease) (Ubuntu 4.1.2-16ubuntu1)] on linux2 Type "help", > >> > "copyright", "credits" or "license" for more information. > >> > >>> class MyInt(int): > >> > ... pass > >> > ... > >> > >>> import sys > >> > >>> MyInt(sys.maxint) > >> > 2147483647 > >> > >>> MyInt(sys.maxint+1) > >> > 2147483648 > >> > >> I'd be interested in knowing what happens in 3.0a1 with > >> > >> a = itertools.count(sys.maxint) > >> print a.next() > >> print a.next() > > > > > >>>> print(next(a)) > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > OverflowError: cannot count beyond PY_SSIZE_T_MAX > > > > Hum, you've got me there. it is the same as in 2.x. Maybe the message > > should be less crypt, at least - nothing that googling for > > PY_SSIZE_T_MAX cant help. > > This should demonstrate that OverflowError will not disappear entirely > even in Python 3.
No one is denying that by now :) > Even if we were to get rid of all OverflowErrors resulting from integer > operations in Python, there are going to be some C extensions--including > some in the Python standard library--that will store 32-bit integers. > Modules such as array and struct will still raise it, and probably other > modules were a long integer sometimes doesn't make sense (socket, for > instance). itertools.count() should work for arbitrary integers, though. Agreed. I was lookind at itertoolsmodule.c, and even for my very limited C knowlegment, it does not seem to be too hard. Anyway: http://bugs.python.org/issue1165 > Carl Banks > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://www.advogato.org/person/eopadoan/ Bookmarks: http://del.icio.us/edcrypt -- http://mail.python.org/mailman/listinfo/python-list