[Python-checkins] GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)

miss-islington webhook-mailer at python.org
Sun Sep 18 18:53:36 EDT 2022


https://github.com/python/cpython/commit/8e2bda8227e80444f9f3a1fe4e24d2d5f4f89385
commit: 8e2bda8227e80444f9f3a1fe4e24d2d5f4f89385
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-09-18T15:53:31-07:00
summary:

GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)

(cherry picked from commit bbc24b2bd569108b957ed24c5a95ffeaf8cde0db)

Co-authored-by: Raymond Hettinger <rhettinger at users.noreply.github.com>

files:
M Doc/faq/programming.rst
M Doc/library/functools.rst

diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst
index 6514c00d1114..a3fb2fa5323c 100644
--- a/Doc/faq/programming.rst
+++ b/Doc/faq/programming.rst
@@ -1897,6 +1897,8 @@ The classes can be used like this:
     'blog-why-python-rocks'
 
 
+.. _faq-cache-method-calls:
+
 How do I cache method calls?
 ----------------------------
 
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 00aca09bc7af..d6792ed6fb77 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -191,6 +191,9 @@ The :mod:`functools` module defines the following functions:
    The cache keeps references to the arguments and return values until they age
    out of the cache or until the cache is cleared.
 
+   If a method is cached, the `self` instance argument is included in the
+   cache.  See :ref:`faq-cache-method-calls`
+
    An `LRU (least recently used) cache
    <https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)>`_
    works best when the most recent calls are the best predictors of upcoming



More information about the Python-checkins mailing list