You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The in-code documentation for the lru_cache function states:
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.
Specifically for 3.0 and 3, even if typed is False, they are still treated as distinct calls, as int is fast-tracked.
The online documentation states correctly:
(Some types such as str and int may be cached separately even when typed is false.)
I know the docstrings are seldom used, but if they already exists, at least they should be accurate as IDEs sometimes show them. Simply changing the example to f(3.0) and f(Decimal("3.0")) should suffice.
Your environment
CPython versions tested on: 3.13 (dev), applies to all supported CPython versions
Bug report
The in-code documentation for the lru_cache function states:
Specifically for 3.0 and 3, even if typed is False, they are still treated as distinct calls, as
int
is fast-tracked.The online documentation states correctly:
I know the docstrings are seldom used, but if they already exists, at least they should be accurate as IDEs sometimes show them. Simply changing the example to
f(3.0)
andf(Decimal("3.0"))
should suffice.Your environment
Linked PRs
The text was updated successfully, but these errors were encountered: