"André" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

>Terry Reedy wrote:
>> It appears that s[i:j:-1] is s[(j+1):(i+1)] .reverse()'ed.  For 
>> 'numbers',
>> this is 10, 9, 8, 7, 6, 5, 4, 3, 2].  Then take every other item.  Why 
>> the
>> +1?  Don't know and not my intuitive expectation.  I just know that
>> extended slicing was developed for and until recently pretty much
<> restricted to numeric (now numpy).

> It's not simply "+1".

Yes it is.  Boundary adjustment follows, as implied by what I wrote.

> >>> a = range(10)
> >>> a[9:0:-2]
> >>> a[10:0:-2]
> >>> a[11:0:-2]
> >>> a[42:0:-2]

are all [9, 7, 5, 3, 1] because a[1:10] == a[1:11] == a[1:12] == a[1:43] == 
[1,3,5,7,9], which is then reversed.

Terry Jan Reedy





-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to