Skip to content

Commit fa86a77

Browse files
carljmhauntsaninja
andauthored
gh-104112: link from cached_property docs to method-caching FAQ (#104113)
Co-authored-by: Shantanu <[email protected]>
1 parent 46361bb commit fa86a77

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

Doc/library/functools.rst

+4-12
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,10 @@ The :mod:`functools` module defines the following functions:
110110
``__slots__`` without including ``__dict__`` as one of the defined slots
111111
(as such classes don't provide a ``__dict__`` attribute at all).
112112

113-
If a mutable mapping is not available or if space-efficient key sharing
114-
is desired, an effect similar to :func:`cached_property` can be achieved
115-
by a stacking :func:`property` on top of :func:`cache`::
116-
117-
class DataSet:
118-
def __init__(self, sequence_of_numbers):
119-
self._data = sequence_of_numbers
120-
121-
@property
122-
@cache
123-
def stdev(self):
124-
return statistics.stdev(self._data)
113+
If a mutable mapping is not available or if space-efficient key sharing is
114+
desired, an effect similar to :func:`cached_property` can also be achieved by
115+
stacking :func:`property` on top of :func:`lru_cache`. See
116+
:ref:`faq-cache-method-calls` for more details on how this differs from :func:`cached_property`.
125117

126118
.. versionadded:: 3.8
127119

0 commit comments

Comments
 (0)