1-liner to iterate over infinite sequence of integers?

Paul Rubin http
Thu Oct 13 14:46:08 EDT 2005


"Fredrik Lundh" <fredrik at pythonware.com> writes:
>     itertools.count() # 0-based
>     itertools.count(1) # 1-based
> 
> gives you an iterator that generates all Python integers (the behaviour
> when it exceeds sys.maxint doesn't seem to be defined, but 2.4 wraps
> around to -(sys.maxint+1))

Ugh, I'd say that's a bad bug.  It should be cleaned up to promote to
long (int/long unification you know) and documented to do that.  



More information about the Python-list mailing list