讨论数量:
Decorator
def decorator(func):
def new_function(*args, **kwargs): # New function defined
""" Actions before 'func' called """
value = func(*args, **kwargs) # Call `func` and keep the result
""" Action after 'func' called """
return value # Return the result
return new_function # Return the new function
Last line in your decorator function, it should return the new function, but it execute the function without any arguments.
return inner()
Should be
return inner


![![![
]
关于 LearnKu
Decorator
Last line in your decorator function, it should return the new function, but it execute the function without any arguments.
Should be