Decorator to register function
- Pytest, Flask probably do this
examples/decorators/register.py
functions = [] def register(func): global functions functions.append(func.__name__) return func @register def f(): print("in f") print(functions)
functions = [] def register(func): global functions functions.append(func.__name__) return func @register def f(): print("in f") print(functions)