decorator

Run Settings
LanguagePython
Language Version
Run Command
#decorator function def dec(func): amount = 0 def wrapper(sales): nonlocal amount amount += sales print("before external function is called") func(sales) print("after external function is called:", amount) return wrapper @dec def production(sales): print(sales) @dec def shipping(cost): print("total expenses:", cost) production(1) production(2) production(3) shipping(10) shipping(20) shipping(30)
Editor Settings
Theme
Key bindings
Full width
Lines