[New-bugs-announce] [issue2041] __getslice__ still called
Stefan Seefeld
report at bugs.python.org
Thu Feb 7 19:19:21 CET 2008
New submission from Stefan Seefeld:
The python documentation states that since python 2.0 __getslice__ is
obsoleted by __getitem__. However, testing with python 2.3 as well as
2.5, I find the following surprising behavior:
class Tuple(tuple):
def __getitem__(self, i): print '__getitem__', i
def __getslice__(self, i): print '__getslice__', i
t = Tuple()
t[0] # __getitem__ called with type(i) == int
t[0:2] # __getslice__ called with type(i) == slice
t[0:2:1] # __getitem__ called with type(i) == slice
----------
components: Interpreter Core
messages: 62162
nosy: stefan
severity: major
status: open
title: __getslice__ still called
type: behavior
versions: Python 2.3, Python 2.5
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2041>
__________________________________
More information about the New-bugs-announce
mailing list