mirror of
https://github.com/python/cpython.git
synced 2025-11-09 06:01:05 +00:00
Update weakref.rst (GH-14098)
This commit is contained in:
parent
0237265e82
commit
f475729a71
1 changed files with 6 additions and 5 deletions
|
|
@ -65,8 +65,8 @@ exposed by the :mod:`weakref` module for the benefit of advanced uses.
|
||||||
|
|
||||||
Not all objects can be weakly referenced; those objects which can include class
|
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,
|
instances, functions written in Python (but not in C), instance methods, sets,
|
||||||
frozensets, some :term:`file objects <file object>`, :term:`generator`\s, type
|
frozensets, some :term:`file objects <file object>`, :term:`generators <generator>`,
|
||||||
objects, sockets, arrays, deques, regular expression pattern objects, and code
|
type objects, sockets, arrays, deques, regular expression pattern objects, and code
|
||||||
objects.
|
objects.
|
||||||
|
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
|
|
@ -80,9 +80,10 @@ support weak references but can add support through subclassing::
|
||||||
|
|
||||||
obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable
|
obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable
|
||||||
|
|
||||||
|
.. impl-detail::
|
||||||
|
|
||||||
Other built-in types such as :class:`tuple` and :class:`int` do not support weak
|
Other built-in types such as :class:`tuple` and :class:`int` do not support weak
|
||||||
references even when subclassed (This is an implementation detail and may be
|
references even when subclassed.
|
||||||
different across various Python implementations.).
|
|
||||||
|
|
||||||
Extension types can easily be made to support weak references; see
|
Extension types can easily be made to support weak references; see
|
||||||
:ref:`weakref-support`.
|
:ref:`weakref-support`.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue