]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Docs: Fix cached calls count in factorial example (gh-140882) (gh-141031)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 Nov 2025 18:14:12 +0000 (19:14 +0100)
committerGitHub <noreply@github.com>
Wed, 5 Nov 2025 18:14:12 +0000 (12:14 -0600)
Co-authored-by: Clifford Gama <cliffygamy@gmail.com>
Doc/library/functools.rst

index f8ffb3f41d1210e027bc1a434bdc708a20399cbc..8028cfc34d7e26957b472a729c67bf2dffd3002a 100644 (file)
@@ -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