classification
Title: Fix weakref doc
Type: enhancement Stage:
Components: Documentation Versions: Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Prometheus3375, docs@python
Priority: normal Keywords:

Created on 2021-07-21 20:30 by Prometheus3375, last changed 2021-07-21 20:30 by Prometheus3375.

Messages (1)
msg397960 - (view) Author: Svyatoslav (Prometheus3375) * Date: 2021-07-21 20:30
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.
""
History
Date User Action Args
2021-07-21 20:30:56Prometheus3375create