Wednesday, August 24, 2011

Range woes

If you've ever iterated, you probably know about the built-in range() and xrange() functions. They usually do the job, but neither is perfect. xrange() can't deal with numbers larger than the system max integer, while range() chokes on very long ranges:

If you simply must have numbers larger than sys.maxint, then you need to use range() while limiting the length with a start argument.

No comments:

Post a Comment