Skip to content

Commit b59289f

Browse files
committed
pythongh-101815: fix functools.cached_property key sharing doc warnings
1 parent 61f2be0 commit b59289f

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

Doc/library/functools.rst

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,20 +86,17 @@ The :mod:`functools` module defines the following functions:
8686
The cached value can be cleared by deleting the attribute. This
8787
allows the *cached_property* method to run again.
8888

89-
Note, this decorator interferes with the operation of :pep:`412`
90-
key-sharing dictionaries. This means that instance dictionaries
91-
can take more space than usual.
92-
93-
Also, this decorator requires that the ``__dict__`` attribute on each instance
94-
be a mutable mapping. This means it will not work with some types, such as
89+
This decorator requires that the ``__dict__`` attribute on each instance be a
90+
mutable mapping. This means it will not work with some types, such as
9591
metaclasses (since the ``__dict__`` attributes on type instances are
9692
read-only proxies for the class namespace), and those that specify
97-
``__slots__`` without including ``__dict__`` as one of the defined slots
98-
(as such classes don't provide a ``__dict__`` attribute at all).
93+
``__slots__`` without including ``__dict__`` as one of the defined slots (as
94+
such classes don't provide a ``__dict__`` attribute at all). Also, accessing
95+
``__dict__`` can cause object instances to use slightly more memory.
9996

100-
If a mutable mapping is not available or if space-efficient key sharing
101-
is desired, an effect similar to :func:`cached_property` can be achieved
102-
by a stacking :func:`property` on top of :func:`cache`::
97+
If a mutable mapping is not available, an effect similar to
98+
:func:`cached_property` can be achieved by a stacking :func:`property` on top
99+
of :func:`cache`::
103100

104101
class DataSet:
105102
def __init__(self, sequence_of_numbers):

0 commit comments

Comments
 (0)