Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

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.

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33322>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to