suppose i have a list like this:
my_list = [0,1,2,3,4,5] # range(5)
num_of_elems_i_want = 3
print(my_list[::-1][len(my_list) - num_of_elems_i_want:])
You could slice the
list as shown:
print(my_list[2::-1]) # L[start:end:step]
The result that you had obtained is not a Bug.
Remember that traversal of the
list elements takes place from left to right and there are no elements till
end=-4 [viz elements: 5>0>1>2]. So, an empty
list is obtained as a result.
For the same reason, you could also do