gh-105172: Fixed functools.lru_cache typed argument docstring. (GH-105173)

https://github.com/python/cpython/commit/f332594dd47947612e1e5d2faf287930552... commit: f332594dd47947612e1e5d2faf287930552a5110 branch: main author: Bar Harel <bharel@barharel.com> committer: rhettinger <rhettinger@users.noreply.github.com> date: 2023-05-31T17:56:06-05:00 summary: gh-105172: Fixed functools.lru_cache typed argument docstring. (GH-105173) files: A Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst M Lib/functools.py diff --git a/Lib/functools.py b/Lib/functools.py index 72b2103e7a55..4d5e27090078 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -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. diff --git a/Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst b/Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst new file mode 100644 index 000000000000..96cf7220e530 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-05-31-23-05-51.gh-issue-105172.SVfvkD.rst @@ -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.
participants (1)
-
rhettinger