Decorators
What is decorators?
It accepts the functions and add the decorator-like function into the original functions to achieve certain functions.
Examples:
Apply the function of measuring execution time on each function.
1 | # -*- coding: utf-8 -*- |
See more details in the blog of liaoxuefeng.
Reference
- liaoxuefeng: Decorators https://www.liaoxuefeng.com/wiki/1016959663602400/1017451662295584
- Python: 使用装饰器“@”取得函数执行时间 https://oldj.net/blog/2010/05/22/decorator-get-execution-time