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 steven.daprano
Recipients jpthalman, steven.daprano
Date 2018-04-21.07:21:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1524295269.96.0.682650639539.issue33322@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 2, you have to override __getslice__ as well as __getitem__.

Try this instead:


class MyTuple(tuple):
    def __getitem__(self, pos):
        print "get item {}".format(pos)
        return super(MyTuple, self).__getitem__(pos)
    def __getslice__(self, *args):
        print "get slice {}".format(args)
        return super(MyTuple, self).__getslice__(*args)


I don't believe this is a bug. If you try with the above fix, and still believe there is a bug, please feel free to re-open the issue.
History
Date User Action Args
2018-04-21 07:21:10steven.dapranosetrecipients: + steven.daprano, jpthalman
2018-04-21 07:21:09steven.dapranosetmessageid: <1524295269.96.0.682650639539.issue33322@psf.upfronthosting.co.za>
2018-04-21 07:21:09steven.dapranolinkissue33322 messages
2018-04-21 07:21:09steven.dapranocreate