@@ -171,10 +171,10 @@ See :ref:`__slots__ documentation <slots>` for details.
171
171
Added support for ``| `` and ``|= `` operators, specified in :pep: `584 `.
172
172
173
173
: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
176
176
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
178
178
than needed.
179
179
180
180
@@ -294,7 +294,7 @@ objects.
294
294
.. note ::
295
295
296
296
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,
298
298
since otherwise *obj * will never be garbage collected. In
299
299
particular, *func * should not be a bound method of *obj *.
300
300
@@ -336,7 +336,7 @@ Weak Reference Objects
336
336
----------------------
337
337
338
338
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
340
340
obtained, if it still exists, by calling it:
341
341
342
342
>>> import weakref
@@ -349,7 +349,7 @@ obtained, if it still exists, by calling it:
349
349
>>> o is o2
350
350
True
351
351
352
- If the referent no longer exists, calling the reference object returns
352
+ If the referent no longer exists, calling the weak reference returns
353
353
:const: `None `:
354
354
355
355
>>> del o, o2
@@ -377,7 +377,7 @@ applications as well as single-threaded applications.
377
377
Specialized versions of :class: `ref ` objects can be created through subclassing.
378
378
This is used in the implementation of the :class: `WeakValueDictionary ` to reduce
379
379
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
381
381
insert additional processing on calls to retrieve the referent.
382
382
383
383
This example shows how a subclass of :class: `ref ` can be used to store
@@ -395,7 +395,7 @@ the referent is accessed::
395
395
396
396
def __call__(self):
397
397
"""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.
399
399
"""
400
400
ob = super().__call__()
401
401
if ob is not None:
@@ -533,7 +533,7 @@ However, handling of :meth:`__del__` methods is notoriously implementation
533
533
specific, since it depends on internal details of the interpreter's garbage
534
534
collector implementation.
535
535
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
537
537
the specific functions and objects that it needs, rather than having access
538
538
to the full state of the object::
539
539
0 commit comments