]> 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)
committerPablo Galindo <pablogsal@gmail.com>
Sat, 22 Oct 2022 19:06:09 +0000 (20:06 +0100)
(cherry picked from commit bbc24b2bd569108b957ed24c5a95ffeaf8cde0db)

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

index 676dfae61aca079c6747a61ab8b7afebc794cf65..76bd1538b4101586a5cb6f4febba66ace71da13a 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