decorator

Run Settings
LanguagePython
Language Version
Run Command
def counter(fn): #wrapper function count = 0 def inner(*args, **kwargs): nonlocal count count += 1 print('Function {0} was called {1} times'.format(fn.__name__, count)) return fn(*args, **kwargs) return inner def add(a, b=0): return a + b print(id(add)) add = counter(add) result = add(1, 2) result = add(1, 2) result = add(1, 2) print(id(add))
Editor Settings
Theme
Key bindings
Full width
Lines