def deco func def wrapper args kwargs print got called with args and k

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
def deco(func):
def wrapper(*args,**kwargs):
print 'got called with',args,'and',kwargs
# doing here some useful things
# ...
# executing the decorated function and return it's result
return func(*args,**kwargs)
# returning wrapper-function
return wrapper
@deco
def some_func():
print 'Hello World'