enumerate overflow

Paul Rubin http
Wed Oct 3 13:05:08 EDT 2007


Tim Chase <python.list at tim.thechases.com> writes:
> I'd consider this a bug:  either in the implementation of enumerate(),
> or in the documentation
> 
> http://docs.python.org/lib/built-in-funcs.html#l2h-24

2.5 has a patch that causes enumerate() and count() to raise overflow
if the count wraps around, which is still bad but at least beats
having the number suddenly go negative.  See:

  http://bugs.python.org/issue1512504     and
  http://mail.python.org/pipermail/python-checkins/2007-February/058486.html

also:

  http://bugs.python.org/issue1326277

I hope in 3.0 there's a real fix, i.e. the count should promote to
long.  The rationale for leaving the bug in the library is just silly.
2**32 is not that big a number if we're talking about a language and
runtime system supposedly good for writing servers that stay up
continuously for years.



More information about the Python-list mailing list