Let's say for the python list
a = [1, 2, 3, 4, 5, 6, 7]
a[2:5]
returns [3, 4, 5]
but to slice from the end to the beginning such that the list becomes circular I tried the following:
a[-1:1]
a[-2:-5]
a[5:2]
all of which returned []
Is there a pythonic way to get this done?
(A naive approach can be to reverse the list if the indices are in reverse order, but is there a optimal one line way inbuilt by python)
Thank you