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

Use @cache and @cache_property from functools for memoization #2288

Closed
valentinsulzer opened this issue Sep 8, 2022 · 5 comments · Fixed by #2465
Closed

Use @cache and @cache_property from functools for memoization #2288

valentinsulzer opened this issue Sep 8, 2022 · 5 comments · Fixed by #2465
Assignees
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours

Comments

@valentinsulzer
Copy link
Member

See https://docs.python.org/3/library/functools.html

We are currently doing this manually using try-except blocks with AttributeError (example). Using the decorators from functools would be cleaner

This is different functionality from using @property with a setter and getter - those should not be changed.

@valentinsulzer valentinsulzer added the difficulty: easy A good issue for someone new. Can be done in a few hours label Sep 8, 2022
@valentinsulzer
Copy link
Member Author

See #2289 for an example of @cached_property

@valentinsulzer
Copy link
Member Author

This isn't available in python 3.7, so we need to wait until we drop support (which should be at latest when it stops being supported on 2023-06-27, see https://www.python.org/downloads/)

@agriyakhetarpal
Copy link
Member

Hi @tinosulzer, I'd be happy to work on this!

@valentinsulzer
Copy link
Member Author

Great!

@agriyakhetarpal
Copy link
Member

Apologies for the delay(s), I'll be working on this in this week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants