https://github.com/python/cpython/commit/2dd0a6ad9c6b94a9ddac716aa894415b74617845 commit: 2dd0a6ad9c6b94a9ddac716aa894415b74617845 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: rhettinger <[email protected]> date: 2025-11-05T12:15:05-06:00 summary:
[3.13] Docs: Fix cached calls count in factorial example (gh-140882) (gh-141032) Co-authored-by: Clifford Gama <[email protected]> files: M Doc/library/functools.rst diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 2885f9a4b7a6ec..18c83b1fda17b3 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -42,11 +42,11 @@ The :mod:`functools` module defines the following functions: def factorial(n): return n * factorial(n-1) if n else 1 - >>> factorial(10) # no previously cached result, makes 11 recursive calls + >>> factorial(10) # no previously cached result, makes 11 recursive calls 3628800 - >>> factorial(5) # just looks up cached value result + >>> factorial(5) # no new calls, just returns the cached result 120 - >>> factorial(12) # makes two new recursive calls, the other 10 are cached + >>> factorial(12) # two new recursive calls, factorial(10) is cached 479001600 The cache is threadsafe so that the wrapped function can be used in _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
