Is this a super bug?

Terry Reedy tjreedy at udel.edu
Sat Apr 19 21:15:23 EDT 2003


"Bjorn Pettersen" <BPettersen at NAREX.com> wrote in message
news:mailman.1050791852.9118.python-list at python.org...
M:\python>python
Python 2.3a2 (#39, Feb 19 2003, 17:58:58) [MSC v.1200 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class ff(str):
...    def foo(self):
...      print 'str.__getitem__', str.__getitem__(self, 0)
...      print 'super(ff, self).__getitem__', super(ff,
self).__getitem__(0)
...      print 'super(ff, self)[0]', super(ff, self)[0]
...
>>> f = ff('asdf')
>>> f.foo()
str.__getitem__ a
super(ff, self).__getitem__ a
super(ff, self)[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<stdin>", line 5, in foo
TypeError: unsubscriptable object
----------
I suspect that printing type(super(ff,self)) might answer your
question.

TJR






More information about the Python-list mailing list