Issue 3454: getitem() doesn't capture all slices if class inherits from list, tuple or str (original) (raw)

When executing self[i:j], the getslice(self,i,j) method is called first, if it exists. See http://docs.python.org/ref/sequence-methods.html

Yes, the (get|set|del)slice methods are deprecated since 2.0, but for compatibility the built-in types must keep defining them. You may want to override them as well if your class inherit from such a type.

With python 3.0 the getslice slots were removed, and getitem is called in all cases.