Grouping code by indentation - feature or ******?

Greg Ewing greg at cosc.canterbury.ac.nz
Fri Apr 1 01:05:11 EST 2005


Javier Bezos wrote:
> 2) You have an ending point (e) and a
>    length: lst[e-t+1:e+1].

If you use the "slice indices represent points between
the elements" mental model, then you don't have an
ending point here, you have one less than the ending
point -- hence it's not surprising that you need to
add 1.

> 3) You have a starting point and an ending
>    point: lst[s:e+1].

Again, you don't really have an ending point.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list