Skip to content

Commit 7a78eeb

Browse files
authored
Normalise and disambiguate
1 parent b8a0169 commit 7a78eeb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Doc/library/weakref.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ See :ref:`__slots__ documentation <slots>` for details.
171171
Added support for ``|`` and ``|=`` operators, specified in :pep:`584`.
172172

173173
:class:`WeakKeyDictionary` objects have an additional method that
174-
exposes the internal references directly. The references are not guaranteed to
175-
be "live" at the time they are used, so the result of calling the references
174+
exposes the internal weak references directly. The weak references are not guaranteed to
175+
be "live" at the time they are used, so the result of calling them
176176
needs to be checked before being used. This can be used to avoid creating
177-
references that will cause the garbage collector to keep the keys around longer
177+
strong references that will cause the garbage collector to keep the keys around longer
178178
than needed.
179179

180180

@@ -294,7 +294,7 @@ objects.
294294
.. note::
295295

296296
It is important to ensure that *func*, *args* and *kwargs* do
297-
not own any references to *obj*, either directly or indirectly,
297+
not own any strong references to *obj*, either directly or indirectly,
298298
since otherwise *obj* will never be garbage collected. In
299299
particular, *func* should not be a bound method of *obj*.
300300

@@ -336,7 +336,7 @@ Weak Reference Objects
336336
----------------------
337337

338338
Weak references have no methods and no attributes besides
339-
:attr:`ref.__callback__`. A weak reference allows the referent to be
339+
:attr:`ref.__callback__`. A weak reference allows the referent to be
340340
obtained, if it still exists, by calling it:
341341

342342
>>> import weakref
@@ -349,7 +349,7 @@ obtained, if it still exists, by calling it:
349349
>>> o is o2
350350
True
351351

352-
If the referent no longer exists, calling the reference object returns
352+
If the referent no longer exists, calling the weak reference returns
353353
:const:`None`:
354354

355355
>>> del o, o2
@@ -377,7 +377,7 @@ applications as well as single-threaded applications.
377377
Specialized versions of :class:`ref` objects can be created through subclassing.
378378
This is used in the implementation of the :class:`WeakValueDictionary` to reduce
379379
the memory overhead for each entry in the mapping. This may be most useful to
380-
associate additional information with a reference, but could also be used to
380+
associate additional information with a weak reference, but could also be used to
381381
insert additional processing on calls to retrieve the referent.
382382

383383
This example shows how a subclass of :class:`ref` can be used to store
@@ -395,7 +395,7 @@ the referent is accessed::
395395

396396
def __call__(self):
397397
"""Return a pair containing the referent and the number of
398-
times the reference has been called.
398+
times the weak reference has been called.
399399
"""
400400
ob = super().__call__()
401401
if ob is not None:
@@ -533,7 +533,7 @@ However, handling of :meth:`__del__` methods is notoriously implementation
533533
specific, since it depends on internal details of the interpreter's garbage
534534
collector implementation.
535535

536-
A more robust alternative can be to define a finalizer which only references
536+
A more robust alternative can be used to define a finalizer which only references
537537
the specific functions and objects that it needs, rather than having access
538538
to the full state of the object::
539539

0 commit comments

Comments
 (0)