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.
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You