You define a decorator just like any other method.
定义修饰符与定义其他方法无异。
It is not hard to create a decorator that "enhances" a regular numerical function.
创建一个可以“增强”普通数值函数的decorator并不困难。
A decorator, being a Python function, can do absolutely anything other Python code can.
作为一个python函数,decorator完全可以实现其他Python代码所实现的任何功能。
But I can make a decorator without adding the extra structure of a class-based approach.
但是,我在创建修饰符时可以不用添加额外的基于类的方法结构。
Decorator: I'll do my best, thank you.
装饰者:我会尽力的,谢谢你。
Decorator: What would you like to include in the design?
室内设计师:那么您想在设计中包括什么?
Decorator: All right! I will make some drawings for you to see.
室内设计师:好的!我会画出来让您看看。
Decorator: All right! I will make some drawings for you to see.
室内设计师:好的!我会画出来让您看看。
应用推荐