Steven D'Aprano <[email protected]> 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 <[email protected]>
<https://bugs.python.org/issue38099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com