New submission from Reed <rea...@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@python
components: Documentation
messages: 351765
nosy: docs@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue38099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to