What does the syntax [::-1] really mean?

Duncan Booth duncan.booth at invalid.invalid
Thu Oct 4 22:32:12 CEST 2007

Duncan Booth <duncan.booth at invalid.invalid> wrote:

> the invariant that you are looking for is that for all non-negative a, b:
>    x[a:b:1] reversed is x[-len(x)+b-1:-len(x)+a-1:-1]
I should of course have said "all a, b in the range 0 <= a <= len(x) and 0 
<= b <= len(x)".

More information about the Python-list mailing list