I wonder if it would have been simpler if we had defined a[i:j:-1] as the reverse of a[i:j]?

Maybe, I'm not venturing an opinion.
But if so:  What about negative strides other than -1?  Should a[i:j:-2] always be the reverse of a[i:j:2]?
My feeling is not, i.e.
"abcdefghij"[3:8:2] == "dfh"
but I feel that
"abcdefghij"[3:8:-2] under this suggestion should be what "abcdefghij"[8:3:-2] is now, i.e. "ige", not "hfd".
I.e. any non-empty start:stop:stride slice where 0 <= slice < length should always start with the character indexed by "start".
Rob Cliffe
What are real use cases for negative strides?

--Guido van Rossum (python.org/~guido)

Python-ideas mailing list

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2242 / Virus Database: 3222/6285 - Release Date: 10/27/13