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

Replace usage of @functools.lru_cache(max_size=None) with @functools.cache once python 3.8 is dropped #2161

Open
parthea opened this issue Sep 14, 2024 · 0 comments
Assignees
Labels
type: cleanup An internal cleanup or hygiene concern.

Comments

@parthea
Copy link
Contributor

parthea commented Sep 14, 2024

Once Python 3.8 is dropped, we should use @functools.cache, which was added in Python3.9, instead of @functools.lru_cache(max_size=None)

From https://docs.python.org/3/library/functools.html#functools.cache,

@functools.cache returns the same as lru_cache(maxsize=None), creating a thin wrapper around a dictionary lookup for the function arguments. Because it never needs to evict old values, this is smaller and faster than lru_cache() with a size limit.

@parthea parthea added the type: cleanup An internal cleanup or hygiene concern. label Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

No branches or pull requests

1 participant