]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 18 Sep 2022 22:53:31 +0000 (15:53 -0700)
committerGitHub <noreply@github.com>
Sun, 18 Sep 2022 22:53:31 +0000 (15:53 -0700)
(cherry picked from commit bbc24b2bd569108b957ed24c5a95ffeaf8cde0db)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Doc/faq/programming.rst
Doc/library/functools.rst

index 6514c00d1114e20f7e569be86b79cb17df3e3a20..a3fb2fa5323cf6350a2d050e8b708a7108fee20e 100644 (file)
@@ -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?
 ----------------------------
 
index 00aca09bc7af45323440521bfcfa0be05e4983a3..d6792ed6fb77fb3b0f7162cd17f82cb871c066e1 100644 (file)
@@ -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