Skip to content

caching functions without arguments #10

@bmc-msft

Description

@bmc-msft

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-1-normalThis issue has a normal prioritysize-smallEasy work need to be done

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions