[issue11455] issue a warning when populating a CPython type dict with non-string keys
Alex
report at bugs.python.org
Thu Mar 10 19:53:48 CET 2011
Alex <alex.gaynor at gmail.com> added the comment:
How can they be set afterwords?
alex at alex-laptop:~/projects/pypy$ python3.1
Python 3.1.2 (release31-maint, Sep 17 2010, 20:34:23)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
... pass
...
>>> A.__dict__[32] = "heh"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'dict_proxy' object does not support item assignment
>>> setattr(A, 32, "heh")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: attribute name must be string, not 'int'
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11455>
_______________________________________
More information about the Python-bugs-list
mailing list