]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
More realistic lru_cache example (gh-144517)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Thu, 5 Feb 2026 18:04:12 +0000 (12:04 -0600)
committerGitHub <noreply@github.com>
Thu, 5 Feb 2026 18:04:12 +0000 (12:04 -0600)
Doc/library/functools.rst

index 221c0712c7c96a15375bd5ec55f35e53d6e15492..b7c34bc64135ba78b5c961792091ba69876de85b 100644 (file)
@@ -180,8 +180,8 @@ The :mod:`functools` module defines the following functions:
    the *maxsize* at its default value of 128::
 
        @lru_cache
-       def count_vowels(sentence):
-           return sum(sentence.count(vowel) for vowel in 'AEIOUaeiou')
+       def count_vowels(word):
+           return sum(word.count(vowel) for vowel in 'AEIOUaeiou')
 
    If *maxsize* is set to ``None``, the LRU feature is disabled and the cache can
    grow without bound.