I forgot to mention: >>> mytup=("fred","barney") >>> tuple.__getitem__(mytup,0) 'fred'
On Tuesday 21 December 2004 09:41 am, VanL wrote: > Hello, > > Why is this? > > >>> class MyTuple(tuple): > > ... def __getitem__(self, name): > ... return tuple.__getitem__(self, name) > ... > > >>> data = (1,2,3,4,5) > >>> t = MyTuple(data) > >>> t[0] > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "<stdin>", line 3, in __getitem__ > TypeError: descriptor '__getitem__' requires a 'tuple' object but > received a 'int' > > Thanks, > > VL -- James Stroud, Ph.D. UCLA-DOE Institute for Genomics and Proteomics 611 Charles E. Young Dr. S. MBI 205, UCLA 951570 Los Angeles CA 90095-1570 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list