[New-bugs-announce] [issue38099] __dict__ attribute is incorrectly stated to be read-only

Reed report at bugs.python.org
Wed Sep 11 02:21:11 EDT 2019


New submission from Reed <readuw at gmail.com>:

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?)

----------
assignee: docs at python
components: Documentation
messages: 351765
nosy: docs at python, reed
priority: normal
severity: normal
status: open
title: __dict__ attribute is incorrectly stated to be read-only
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38099>
_______________________________________


More information about the New-bugs-announce mailing list