In [1]:
from functools import wraps
In [8]:
def kyword_only(x,**kwargs):
print(x)
for i in kwargs.items():
print(i)
arg = {'c': 9, 'd': 10}
f_1 = kyword_only(2, **arg)
In [9]:
def deg_option(func):
"""
"""
@wraps(func)
def wrapper(*args, deg=False, **kwargs):
if deg:
print('calling, ', func.__name__)
return func(*args)
return wrapper
@deg_option
def my_sum(*arg):
if arg:
return max(arg)
args = [4, 8, 9, 11, 5]
f_2 = my_sum(*args, deg=True)
f_2
Out[9]: