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

caching functions without arguments #10

Closed
bmc-msft opened this issue Jun 25, 2020 · 1 comment
Closed

caching functions without arguments #10

bmc-msft opened this issue Jun 25, 2020 · 1 comment
Labels
priority-1-normal This issue has a normal priority size-small Easy work need to be done

Comments

@bmc-msft
Copy link

Right now, syntax warning is generated with the following code.

@cached
def expensive_function():
   ...

However, the use of @cached in this context can be useful in some contexts. Example: @cached does effectively the same thing with significantly less code as the following construct using a global variable:

HAS_RUN=False
def expensive_function():
   global HAS_RUN
   if HAS_RUN:
      return
   else:
      HAS_RUN=True

Can this syntax warning be configurable and/or removed?

@lonelyenvoy lonelyenvoy added priority-1-normal This issue has a normal priority size-small Easy work need to be done labels Dec 19, 2020
@lonelyenvoy
Copy link
Owner

lonelyenvoy commented Aug 1, 2021

Resolved in v0.4.0. Now available at PyPI or GitHub Releases.

Please upgrade by: pip install -U memoization

The SyntaxWarning on functions without arguments has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-1-normal This issue has a normal priority size-small Easy work need to be done
Projects
None yet
Development

No branches or pull requests

2 participants