str.__getslice__ is not working as expected with negative stop

Viewed 90

I was trying to run following code in python 2.7:

foo = "python is awesome"
print foo[10:16]
print foo.__getslice__(10,16)
print foo[10:-1]
print foo.__getslice__(10,-1)

all except the last one printed "awsome". but foo.__getslice__(10,-1) returned an empty string. Why is it so?

1 Answers
Related