[docs] [issue38099] __dict__ attribute is incorrectly stated to be read-only
Steven D'Aprano
report at bugs.python.org
Wed Sep 11 04:57:58 EDT 2019
Steven D'Aprano <steve+python at pearwood.info> 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 "<stdin>", line 1, in <module>
AttributeError: attribute '__dict__' of 'type' objects is not writable
> What is the difference between an object and an instance?
In general, nothing. But ``object.__dict__`` refers to the special builtin *class* called "object". In hindsight, we should have called it Object, so we could more easily distinguish between the *class* called "object" and *instances* of that class.
py> print(object) # the class/type itself
<class 'object'>
py> print(object()) # an instance of object
<object object at 0xb7ce1cd0>
The docs are correct here, but if you care to suggest some improvements, we will consider them.
----------
nosy: +steven.daprano
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38099>
_______________________________________
More information about the docs
mailing list