[issue44702] Fix weakref doc

Svyatoslav report at bugs.python.org
Wed Jul 21 16:30:57 EDT 2021


New submission from Svyatoslav <prometheus3375 at gmail.com>:

>From https://docs.python.org/3/library/weakref.html:
""
Not all objects can be weakly referenced; those objects which can include class instances, functions written in Python (but not in C), instance methods, sets, frozensets, some file objects, generators, type objects, sockets, arrays, deques, regular expression pattern objects, and code objects.
""

My first perception was that this is the list of objects without weakref support. Actually, the sentence lists objects which do support weakref. While writing this report I understood: "can" does not relate to "include" at all. The correct way of reading is "those objects | which can | include ...". Previously I had read it as "those objects | which can include ...". Even Google translates in such manner, commas do not help.

To remove ambguity, I suggest such fix:
""
Not all objects can be weakly referenced. Objects which support weak references include class instances, functions written in Python (but not in C), instance methods, sets, frozensets, some file objects, generators, type objects, sockets, arrays, deques, regular expression pattern objects, and code objects.
""
or
""
Not all objects can be weakly referenced. Сlass instances, functions written in Python (but not in C), instance methods, sets, frozensets, some file objects, generators, type objects, sockets, arrays, deques, regular expression pattern objects, and code objects support weak references.
""

----------
assignee: docs at python
components: Documentation
messages: 397960
nosy: Prometheus3375, docs at python
priority: normal
severity: normal
status: open
title: Fix weakref doc
type: enhancement
versions: Python 3.9

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


More information about the Python-bugs-list mailing list