summaryrefslogtreecommitdiffstats
path: root/Doc/library/functools.rst
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2023-05-04 22:38:53 (GMT)
committerGitHub <noreply@github.com>2023-05-04 22:38:53 (GMT)
commitfa86a77589a06661fcebb806d36f3a7450e2aecf (patch)
tree27101c266780fd8770c97f7e123d6d87b19d68b1 /Doc/library/functools.rst
parent46361bb84332800bc3632688e6ef3b4dd4a48723 (diff)
downloadcpython-fa86a77589a06661fcebb806d36f3a7450e2aecf.zip
cpython-fa86a77589a06661fcebb806d36f3a7450e2aecf.tar.gz
cpython-fa86a77589a06661fcebb806d36f3a7450e2aecf.tar.bz2
gh-104112: link from cached_property docs to method-caching FAQ (#104113)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Diffstat (limited to 'Doc/library/functools.rst')
-rw-r--r--Doc/library/functools.rst16
1 files changed, 4 insertions, 12 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 29cbc87..40f43f8 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -110,18 +110,10 @@ The :mod:`functools` module defines the following functions:
``__slots__`` without including ``__dict__`` as one of the defined slots
(as such classes don't provide a ``__dict__`` attribute at all).
- If a mutable mapping is not available or if space-efficient key sharing
- is desired, an effect similar to :func:`cached_property` can be achieved
- by a stacking :func:`property` on top of :func:`cache`::
-
- class DataSet:
- def __init__(self, sequence_of_numbers):
- self._data = sequence_of_numbers
-
- @property
- @cache
- def stdev(self):
- return statistics.stdev(self._data)
+ If a mutable mapping is not available or if space-efficient key sharing is
+ desired, an effect similar to :func:`cached_property` can also be achieved by
+ stacking :func:`property` on top of :func:`lru_cache`. See
+ :ref:`faq-cache-method-calls` for more details on how this differs from :func:`cached_property`.
.. versionadded:: 3.8