You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
__getitem__() doesn't capture all slices if class inherits from list, tuple or str #47704
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2008-07-27.21:17:57.817>created_at=<Date2008-07-27.19:58:01.650>labels= ['interpreter-core', 'performance']
title="__getitem__() doesn't capture all slices if class inherits from list, tuple or str"updated_at=<Date2008-07-27.21:17:57.775>user='https://bugs.python.org/johnf'
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.
Activity
amauryfa commentedon Jul 27, 2008
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.