This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fdrake
Recipients
Date 2003-09-12.20:10:43
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 14:16:48adminlinkissue805304 messages
2007-08-23 14:16:48admincreate