同步操作将从 mirrors_PacktPublishing/Clean-Code-in-Python 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Run the tests with:
make test
Function decorators
1.1 decorator_function_1.py.
1.2 decorator_function_2.py
Class decorators
2.1
decorator_class_1.py2.2
decorator_class_2.py2.3
decorator_class_3.py
Other decorators (generators, coroutines, etc.).
Passing Arguments to Decorators
4.1 As a decorator function:
decorator_parametrized_1.py4.2 As a decorator object:
decorator_parametrized_2.py
Keep the properties of the original attributes (docstring, name, etc.),
by using functools.wraps.
1.1
decorator_wraps_1.py
Don't have side effects on the main body of the decorator. This will run at parsing time, and will most likely fail.
2.1
decorator_side_effects_1.py2.2
decorator_side_effects_2.py
Make sure the decorated function is equivalent to the wrapped one, in terms of inspection, signature checking, etc.
3.1 Create decorators that work for functions, methods, static methods, class methods, etc.
3.2 Use the
wraptpackage to create effective decorators.
The DRY Principle with Decorators (reusing code).
Separation of Concerns with Decorators.
Listings:
decorator_SoC_{1,2}.py
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。