Stumbled upon something slightly perplexing today while writing some unittests:
blah = ['a', 'b', 'c']
blah[:-3] # []
blah[:-2] # ['a']
blah[:-1] # ['a', 'b']
blah[:-0] # []
Can't for the life of me figure out why blah[:-0] # []
should be the case, the pattern definitely seems to suggest that it should be ['a', 'b', 'c']
. Can anybody help to shed some light on why that is the case? Haven't been able to find mention in the docs as to why that is the case.