This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: __getitem__() doesn't capture all slices if class inherits from list, tuple or str
Type: performance Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, johnf
Priority: normal Keywords:

Created on 2008-07-27 19:58 by johnf, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
getitem_problem.py johnf, 2008-07-27 19:58
Messages (1)
msg70329 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-07-27 21:17
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.
History
Date User Action Args
2022-04-11 14:56:37adminsetgithub: 47704
2008-07-27 21:17:57amaury.forgeotdarcsetstatus: open -> closed
resolution: wont fix
messages: + msg70329
nosy: + amaury.forgeotdarc
2008-07-27 19:58:01johnfcreate