Skip to content
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

Minor functools.lru_cache in-code documentation issue #105172

Closed
bharel opened this issue May 31, 2023 · 0 comments
Closed

Minor functools.lru_cache in-code documentation issue #105172

bharel opened this issue May 31, 2023 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@bharel
Copy link
Contributor

bharel commented May 31, 2023

Bug report

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
  • Operating system and architecture: Mac OS Ventura

Linked PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants