I noticed, given l = [1,2,3], that l[-1:] returns [3] as expected, but that l[-1:0] returns [], very much unlike what I expected. I then tried [-1:1], which I expected to return [3,1], but it also returns [].
Is there a good reason why the slice syntax does not wrap around from negative to positive indices (and the other way round)?
It seems it would be pretty useful and pretty straightforward to implement, but maybe I'm missing something.
stepoption, such asl[-1:1:-1]to step backward one element at a time.[-1:1]could result in[3,1,2,3,1]as well. Also, that way is would be pretty much impossible to get an empty slice! E.g., should[2:1]also "wrap around", or produce an empty slice? Things like[-3:2]work, as long as the first index (counting from whatever end) is smaller than the second index.l[-1:1]then result in[3,1,2,3,1]as you say?