Skip to content

Instantly share code, notes, and snippets.

@ycui1
Created September 3, 2020 02:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ycui1/58495e1ad3d52626877c0bcdcfc15d67 to your computer and use it in GitHub Desktop.
Save ycui1/58495e1ad3d52626877c0bcdcfc15d67 to your computer and use it in GitHub Desktop.
>>> def repeat(func):
... """Decorator that repeats function call twice"""
... def repeater(*args, **kwargs):
... func(*args, **kwargs)
... func(*args, **kwargs)
...
... return repeater
...
...
... @logging_time("ms")
... @repeat
... def say_hi(whom):
... print(f"Hi, {whom}!")
...
...
... @repeat
... @logging_time("ms")
... def say_hello(whom):
... print(f"Hello, {whom}!")
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment