Python allows negative indexes to lists, with -1 being the last item, -2 the second to last, and so forth.
So your code:
my_list = [3, 1, -2]
Is the equivelant of:
index = my_list[-1]
Since -1 is the last element of the list, index becomes -2, which accesses the second to last element of the list and prints it: 1