5.4. Decorator About Object¶
Decorating function
Decorating class
Decorating method
5.4.1. Decorating Function¶
By convention
func
orfn
>>> def mydecorator(func):
... ...
>>> class MyDecorator:
... def __init__(self, func):
... ...
5.4.2. Decorating Class¶
By convention
cls
>>> def mydecorator(cls):
... ...
>>> class MyDecorator:
... def __init__(self, cls):
... ...
5.4.3. Decorating Method¶
By convention
mth
,meth
ormethod
>>> def mydecorator(mth):
... ...
>>> class MyDecorator:
... def __init__(self, mth):
... ...