DEV Community

Discussion on: Python Decorator Tutorial with Example

Collapse
 
otacilion profile image
Otacilio Saraiva Maia Neto

In this piece of code:

    def inner_function(function):
    @wraps(function)
    def wrapper(*args, **kwargs):
        print "Arguements passed to decorator %s and %s" % (arg1, arg2)
        function(*args, **kwargs)
    return wrapper
    return inner_function
Enter fullscreen mode Exit fullscreen mode


`
is it missing some identation?

Collapse
 
sp1thas profile image
Panagiotis Simakis

Good catch! I'm pretty sure that should look like:

def decorator(arg1, arg2):

    def inner_function(function):
        @wraps(function)
        def wrapper(*args, **kwargs):
            print "Arguements passed to decorator %s and %s" % (arg1, arg2)
            function(*args, **kwargs)
        return wrapper
    return inner_function
Enter fullscreen mode Exit fullscreen mode