[Python-checkins] [3.11] gh-104112: link from cached_property docs to method-caching FAQ (GH-104113) (#104182)
carljm
webhook-mailer at python.org
Thu May 4 19:10:41 EDT 2023
https://github.com/python/cpython/commit/bb4369e15f1335c3842001434e4ae650da9c90d0
commit: bb4369e15f1335c3842001434e4ae650da9c90d0
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: carljm <carl at oddbird.net>
date: 2023-05-04T17:10:34-06:00
summary:
[3.11] gh-104112: link from cached_property docs to method-caching FAQ (GH-104113) (#104182)
gh-104112: link from cached_property docs to method-caching FAQ (GH-104113)
(cherry picked from commit fa86a77589a06661fcebb806d36f3a7450e2aecf)
Co-authored-by: Carl Meyer <carl at oddbird.net>
Co-authored-by: Shantanu <12621235+hauntsaninja at users.noreply.github.com>
files:
M Doc/library/functools.rst
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 7438d4cdadc5..62fcddec0904 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -102,18 +102,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
More information about the Python-checkins
mailing list