Skip to content

Commit bbc24b2

Browse files
authored
GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)
1 parent 2d1a2d9 commit bbc24b2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Doc/faq/programming.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,8 @@ The classes can be used like this:
18971897
'blog-why-python-rocks'
18981898

18991899

1900+
.. _faq-cache-method-calls:
1901+
19001902
How do I cache method calls?
19011903
----------------------------
19021904

Doc/library/functools.rst

+3
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ The :mod:`functools` module defines the following functions:
197197
The cache keeps references to the arguments and return values until they age
198198
out of the cache or until the cache is cleared.
199199

200+
If a method is cached, the `self` instance argument is included in the
201+
cache. See :ref:`faq-cache-method-calls`
202+
200203
An `LRU (least recently used) cache
201204
<https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)>`_
202205
works best when the most recent calls are the best predictors of upcoming

0 commit comments

Comments
 (0)