Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python decorator

from functools import wraps
def debug(func):
    @wraps(func)
    def out(*args, **kwargs):
        print('hello world')
        return func(*args, **kwargs)
    return out

@debug
def add(x, y):
    return x + y
Source by codefreelance.net #
 
PREVIOUS NEXT
Tagged: #python #decorator
ADD COMMENT
Topic
Name
8+8 =