[Python-bugs-list] [ python-Bugs-792656 ] Misleading [i:j:k] slicing description

SourceForge.net noreply at sourceforge.net
Thu Aug 21 12:02:53 EDT 2003


Bugs item #792656, was opened at 2003-08-21 19:02
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=792656&group_id=5470

Category: Documentation
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raoul Gough (raoulgough)
Assigned to: Nobody/Anonymous (nobody)
Summary: Misleading [i:j:k] slicing description

Initial Comment:
Section 2.2.6 (Sequence types), note 5 from the table 
says:

  "The slice of s from i to j with step k is defined as the 
sequence of items with index x = i + n*k such that 0 
<= n < abs(i-j). [...]"

However, n should only range up to (j-i)//k

Note also that (j-i)//k correctly specifies the results for 
negative values of k, and empty sequence returns 
where signof(j-i) != signof (k). Maybe worth mentioning 
that k != 0  (!! :-)

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

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



More information about the Python-bugs-list mailing list