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.

classification
Title: wrong error message of islice indexing
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: johahn, quiver, rhettinger
Priority: normal Keywords:

Created on 2003-10-20 22:46 by quiver, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg18694 - (view) Author: George Yoshida (quiver) (Python committer) Date: 2003-10-20 22:46
If you pass negative values to itertools.islice, you 
get a wrong error message.

Indices for itertools.islice() may be non-negative 
integers(zero is included), but the error message 
says that they must be positive.

I think the message needs to be corrected.


>>> from itertools import islice
>>> l = range(5)
>>> islice(l, 0, None)
<itertools.islice object at 0xa0cfb1c>
>>> islice(l, -1, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: Indices for islice() must be positive.
msg18695 - (view) Author: Johan M. Hahn (johahn) Date: 2003-10-25 10:46
Logged In: YES 
user_id=887415

Patch submitted. Error message changed to "Indices for islice() 
must be non-negative." Also fixed >>> islice('abc', -1).

http://sourceforge.net/tracker/index.php?
func=detail&aid=830070&group_id=5470&atid=305470
msg18696 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-10-28 07:34
Logged In: YES 
user_id=80475

Fixed the error messages.  See Modules/itertoolsmodule.c 1.25
History
Date User Action Args
2022-04-11 14:56:00adminsetgithub: 39433
2003-10-20 22:46:14quivercreate