Message351765
The documentation in this section (https://docs.python.org/3/library/stdtypes.html#special-attributes) states that the __dict__ attribute, and several others, are read-only. In particular, it states:
"The implementation adds a few special read-only attributes to several object types, where they are relevant."
Then it lists several attributes, including __dict__. However, __dict__ is writable. For example:
class A: pass
A().__dict__ = {'x': 1}
Most other listed attributes, such as __class__ and __name__, are writable as well. They should not be documented as read-only.
(Also, I'm not sure why the documentation lists object.__dict__ and instance.__class__. What is the difference between an object and an instance?) |
|
Date |
User |
Action |
Args |
2019-09-11 06:21:11 | reed | set | recipients:
+ reed, docs@python |
2019-09-11 06:21:11 | reed | set | messageid: <1568182871.44.0.335247784266.issue38099@roundup.psfhosted.org> |
2019-09-11 06:21:11 | reed | link | issue38099 messages |
2019-09-11 06:21:11 | reed | create | |
|