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
When using slicing for a sequence object, with a user defined __getslice__ function, the arguments to __getslice__ are changed.
This does not happen when __getslice__is called directly.
Attached is some code that demonstrates the problem.
I checked it on various versions, including my
"Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)", on my Ubuntu machine.
Although __getslice__ is deprecated, there is still usage of the function, and a fix would be useful.
Unfortunately, this is a feature, not a bug. The relevant code is in Python/ceval.c apply_slice(). Calls to s[a:b] get pre-processed before being handed-off to s.__getslice__. This behavior has been around so long, that it is almost certain that there is a good body of existing code that relies on the behavior.
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: