Reed added the comment:
Thank you for the clarification. I didn't realize the section only referred to
types, but it makes sense now that I read the documentation more carefully.
The documentation is still incorrect for certain attributes (e.g. __bases__ and
__name__) as they can be mutated.
Steven D'Aprano added the comment:
Oh, another point...
Python is a little more complicated than some other languages, like Java,
because Python classes (types) are themselves instances (objects) of yet
another class (the so called "metaclass"). Ultimately, all classes are
instances of
Steven D'Aprano added the comment:
"The implementation adds a few special read-only attributes to several object
TYPES" [emphasis added]
py> class MyType:
... pass
...
py> MyType.__dict__ = {}
Traceback (most recent call last):
File "", line 1, in
AttributeError: attribute '__dict__'
New submission from Reed :
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