[Python-bugs-list] [ python-Bugs-827190 ] wrong error message of islice indexing

SourceForge.net noreply at sourceforge.net
Tue Oct 28 02:34:45 EST 2003


Bugs item #827190, was opened at 2003-10-20 17:46
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=827190&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Nobody/Anonymous (nobody)
Summary: wrong error message of islice indexing

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-10-28 02:34

Message:
Logged In: YES 
user_id=80475

Fixed the error messages.  See Modules/itertoolsmodule.c 1.25

----------------------------------------------------------------------

Comment By: Johan M. Hahn (johahn)
Date: 2003-10-25 05:46

Message:
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

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=827190&group_id=5470



More information about the Python-bugs-list mailing list