Skip to content

gh-105172: Fixed functools.lru_cache typed argument docstring. #105173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions Lib/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,9 @@ def lru_cache(maxsize=128, typed=False):
can grow without bound.

If *typed* is True, arguments of different types will be cached separately.
For example, f(3.0) and f(3) will be treated as distinct calls with
distinct results.
For example, f(decimal.Decimal("3.0")) and f(3.0) will be treated as
distinct calls with distinct results. Some types such as str and int may
be cached separately even when typed is false.

Arguments to the cached function must be hashable.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed :func:`functools.lru_cache` docstring accounting for ``typed``
argument's different handling of str and int. Patch by Bar Harel.