Skip to content

Instantly share code, notes, and snippets.

@justxor
Created June 1, 2022 19:20
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 justxor/01db47d7c8df3250bd7a8f1fb2601a36 to your computer and use it in GitHub Desktop.
Save justxor/01db47d7c8df3250bd7a8f1fb2601a36 to your computer and use it in GitHub Desktop.
import time
def slow(seconds):
def decorator_slow(func):
def wrapper( * args, ** kwargs):
print(f '{func.__name__} sleeping {seconds} second')
time.sleep(seconds)
result_value = func( * args, ** kwargs)
return result_value
return wrapper
return decorator_slow
@slow(2)
def func2(num1, num2):
return num1 + num2
sum = func2(3, 4)
print(sum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment