Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading