This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients amaury.forgeotdarc, belopolsky, mark.dickinson, ncoghlan
Date 2008-04-26.08:16:35
SpamBayes Score 0.008519743
Marked as misclassified No
Message-id <1209197802.78.0.513961719878.issue2690@psf.upfronthosting.co.za>
In-reply-to
Content
Given that range() produced a list in the 2.x series (hence limited to
available memory), and xrange() uses int internally for its values (and
hence couldn't even cope with short ranges with values greater than
sys.maxint).

So my preference is to mimic the 2.x range's behaviour in this case by
raising an overflow error if the sequence is too long.

(From Python 2.5.1)

>>> range(2**99, 2**100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: range() result has too many items
>>> range(2**99, 2**99+5)
[633825300114114700748351602688L, 633825300114114700748351602689L,
633825300114114700748351602690L, 633825300114114700748351602691L,
633825300114114700748351602692L]
>>> xrange(2**99, 2**99+5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to int
History
Date User Action Args
2008-04-26 08:16:43ncoghlansetspambayes_score: 0.00851974 -> 0.008519743
recipients: + ncoghlan, amaury.forgeotdarc, mark.dickinson, belopolsky
2008-04-26 08:16:42ncoghlansetspambayes_score: 0.00851974 -> 0.00851974
messageid: <1209197802.78.0.513961719878.issue2690@psf.upfronthosting.co.za>
2008-04-26 08:16:41ncoghlanlinkissue2690 messages
2008-04-26 08:16:39ncoghlancreate