classification
Title: islice doesn't accept large stop values
Type: enhancement Stage: needs patch
Components: Extension Modules Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, terry.reedy, thomasguest
Priority: normal Keywords:

Created on 2009-06-18 07:14 by thomasguest, last changed 2010-11-04 22:11 by terry.reedy.

Messages (4)
msg89494 - (view) Author: Thomas Guest (thomasguest) Date: 2009-06-18 07:14
Python 3.0 (r30:67503, Jan  7 2009, 16:22:01) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin

>>> from itertools import islice, count
>>> islice(count(), (1<<31) - 1)
<itertools.islice object at 0x63a0c0>
>>> islice(count(), (1<<31))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Stop argument for islice() must be a non-negative integer or
None.
msg89646 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2009-06-23 21:28
Clarified the error message in r73535.

Leaving open as a feature request to support arbitrarily large indices.
msg117000 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-09-20 23:11
Unassigning.  If someone is interested creating a patch, I think it is a reasonable request.
msg120456 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-11-04 22:11
In 3.1.2, range handles large numbers.
>>> list(range(1000000000, 50000000000, 10000000000))
[1000000000, 11000000000, 21000000000, 31000000000, 41000000000]
# those are all billions

This means that the 'equivalent' code in the doc will work.
History
Date User Action Args
2010-11-04 22:11:25terry.reedysetnosy: + terry.reedy
messages: + msg120456
2010-09-20 23:11:00rhettingersetpriority: low -> normal
versions: - Python 2.7
messages: + msg117000

assignee: rhettinger ->
stage: needs patch
2009-06-23 21:28:31rhettingersettype: behavior -> enhancement
messages: + msg89646
components: + Extension Modules
versions: + Python 2.7, Python 3.2, - Python 3.0
2009-06-18 08:01:42rhettingersetpriority: low
assignee: rhettinger

nosy: + rhettinger
2009-06-18 07:14:22thomasguestcreate