May-12-2019, 11:15 PM
You can combine decorators by stacking them:
def decorator_one(func): def wrapper(): print('decorator #1') func() return wrapper def decorator_two(func): def wrapper(): print('decorator the second') func() return wrapper @decorator_one @decorator_two def hello(): print('A duck!') hello()
Output:decorator #1
decorator the second
A duck!
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures