Message18148
This snippet produces a TypeError in Python 2.2.3, 2.3,
and CVS:
class C(object):
def __setitem__(self, name, value):
print (name, value)
class D(C):
def __setitem__(self, name, value):
super(D, self)[name] = value
d = D()
d['foo'] = 'bar'
Here's the traceback:
Traceback (most recent call last):
File "/home/fdrake/tmp/setitem.py", line 10, in ?
d['foo'] = 'bar'
File "/home/fdrake/tmp/setitem.py", line 7, in
__setitem__
super(D, self)[name] = value
TypeError: object does not support item assignment
The problem appears to be that the item assignment
isn't getting mapped to the __setitem__ of the base
class, so this is probably somewhere deep in
Objects/typeobject.c. |
|
Date |
User |
Action |
Args |
2007-08-23 14:16:48 | admin | link | issue805304 messages |
2007-08-23 14:16:48 | admin | create | |
|