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.

Author stefan
Recipients stefan
Date 2008-02-07.18:19:20
SpamBayes Score 0.050863862
Marked as misclassified No
Message-id <1202408361.12.0.538007423172.issue2041@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2008-02-07 18:19:21stefansetspambayes_score: 0.0508639 -> 0.050863862
recipients: + stefan
2008-02-07 18:19:21stefansetspambayes_score: 0.0508639 -> 0.0508639
messageid: <1202408361.12.0.538007423172.issue2041@psf.upfronthosting.co.za>
2008-02-07 18:19:20stefanlinkissue2041 messages
2008-02-07 18:19:20stefancreate