[Python-bugs-list] [ python-Bugs-459235 ] tuple __getitem__ limited

noreply@sourceforge.net noreply@sourceforge.net
Thu, 06 Sep 2001 10:11:55 -0700


Bugs item #459235, was opened at 2001-09-06 10:11
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=459235&group_id=5470

Category: Type/class unification
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin v. Löwis (loewis)
Assigned to: Guido van Rossum (gvanrossum)
Summary: tuple __getitem__ limited

Initial Comment:
The __getitem__ of a tuple does not support the
extended slicing. That makes it difficult to delegate
from an object's __getitem__ to a builtin container,
which ought to work through delegating __getitem__

<pre>
class GI:
    def __getitem__(self,a):
        print a

a = GI()
a[1:2]
(1,2,3,4).__getitem__(slice(1,2,None))
</pre>

gives

slice(1, 2, None)
Traceback (most recent call last):
  File "bar.py", line 7, in ?
    (1,2,3,4).__getitem__(slice(1,2,None))


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=459235&group_id=5470