[Python-bugs-list] [ python-Bugs-805304 ] super instances don't
support item assignment
SourceForge.net
noreply at sourceforge.net
Fri Sep 12 16:10:43 EDT 2003
Bugs item #805304, was opened at 2003-09-12 16:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=805304&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 6
Submitted By: Fred L. Drake, Jr. (fdrake)
Assigned to: Nobody/Anonymous (nobody)
Summary: super instances don't support item assignment
Initial Comment:
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.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=805304&group_id=5470
More information about the Python-bugs-list
mailing list