Created
June 1, 2022 19:20
-
-
Save justxor/01db47d7c8df3250bd7a8f1fb2601a36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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