Is this a super bug?

Bjorn Pettersen BPettersen at NAREX.com
Sun Apr 20 00:36:11 CEST 2003


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
>>>





More information about the Python-list mailing list