Open aprotyas opened 2 years ago
Helps us make code less DRY, and is often useful for auxiliary instrumentation (timing, logging, caching, etc.)
Main thoughts:
def logger(func): def wrapper(*args, **kwargs): print('-- start logger --') func(*args, **kwargs) print('-- end logger --') return wrapper @logger def foo(): print('foo')
Reference:
Food for thought:
Helps us make code less DRY, and is often useful for auxiliary instrumentation (timing, logging, caching, etc.)
Main thoughts:
Reference:
Food for thought: