I'm slicing lists in python and can't explain some results. Both of the following seem natural to me:
>>>[0,1,2,3,4,5][1:4:1]
[1, 2, 3]
>>>[0,1,2,3,4,5]
[::-1] == [5,4,3,2,1,0]
However,
>>>[0,1,2,3,4,5][1:4:-1]
[]
thought I expected it to be [3,2,1]. Why does it produce [ ]? Why does it not reverse the list? What happens first inside python, the step or the slicing?
I also found that
>>>[0,1,2,3,4,5][-3:-6:-1]
[3,2,1]