]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Sun, 18 Sep 2022 21:36:20 +0000 (16:36 -0500)
committerGitHub <noreply@github.com>
Sun, 18 Sep 2022 21:36:20 +0000 (16:36 -0500)
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 47cbe59fa49222930538afa6a7400e6cd2b91055..943a05c39d6840bc3188c49a60d284c1997342d5 100644 (file)
@@ -197,6 +197,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