I thought I understood the basics of list slicing in python, but have been receiving an unexpected error while using a negative step on a slice, as follows:
>>> a = list(range(10))
>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> a[:-1]
[0, 1, 2, 3, 4, 5, 6, 7, 8]
>>> a[::-1]
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
>>> a[:-1:-1]
[]
(Note that this is being run in Python 3.5)
Why doesn't a[:-1:-1] reverse step through the a[:-1] slice in the same manner as it does through the whole list with a[::-1]?
I realize that you can use list.reverse() as well, but trying to understand the underlying python slice functionality better.