-
-
Save esenthil2018/76339f1e21aecb9e6581d6eba18ffe50 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def decor_factory(flag=True): | |
| def decor_func(fn): | |
| from functools import wraps | |
| @wraps(fn) | |
| def wrapper_func(*args,**kwargs): | |
| """ | |
| This is the wrapper function | |
| """ | |
| if flag: | |
| print('Flag is True') | |
| else: | |
| print('Flag is False') | |
| return fn(*args, **kwargs) | |
| return wrapper_func | |
| return decor_func | |
| @decor_factory(flag=False) | |
| def orig_func(a,b,c): | |
| """ | |
| returns the product of a,b,c | |
| """ | |
| return (print('This is the product:',a*b*c)) | |
| orig_func(7,9,11) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment