Reputation: 19
As we know
seq[::stride] = [seq[0], seq[stride], ..., seq[-1] ]
But when stride become negative then
seq[::stride] =[seq[-stride], seq[-2*stride], . . . . ]
Why is the latter case not like [seq[0],seq[-stride], . . . . ]
?
Upvotes: 2
Views: 62
Reputation: 896
Because if the stride is negative, the slice always automatically starts from the end and goes backwards.
Upvotes: 3