About __getitem__()

In Python __getitem__(self, index) method is called for both, when you try to get an item at an indexed position and when you want to slice a collection from start to the end position.

In the first case, index is an integer. And in the second case, index is a slice object.

Tips and Tricks Programming Python 3