Jul-11-2019, 07:07 AM
You can do something like this:
def create_func(name): def myfunc(*args, **kwargs): print(args, kwargs) # write function content here return myfunc func_name = 'mys' decorator = lambda x: x # entity decorator globals()[func_name] = decorator(create_func(func_name)) mys(3,4, name='sample')
Output:(3, 4) {'name': 'sample'}