11.4. Decorator About Object¶
Decorating function
Decorating class
Decorating method
11.4.1. Decorating Function¶
By convention
func
orfn
>>> def mydecorator(func):
... ...
>>> class MyDecorator:
... def __init__(self, func):
... ...
11.4.2. Decorating Class¶
By convention
cls
>>> def mydecorator(cls):
... ...
>>> class MyDecorator:
... def __init__(self, cls):
... ...
11.4.3. Decorating Method¶
By convention
mth
,meth
ormethod
>>> def mydecorator(mth):
... ...
>>> class MyDecorator:
... def __init__(self, mth):
... ...