I'm studying decorators and have came through this example that i can't figure it out how it's possible to access the function's parameters sent as parameter (function display_info) within the wrapper_function without receveing then as argument on first place on decorator_function.
(I think I understand the concept of *args and **kwargs, but in the example below it the decorator function only gets one argument to work with, but wrapper that's within access *args that represent the parameters sent along side with display_info).
def decorator_function(originla_function):
def wrapper_function(*args, **kwargs):
#how wrapper accessed the arguments that weren't received on decorator_function
print('wrapper executed before {}'.format(originla_function.__name__))
return originla_function(*args, **kwargs)
return wrapper_function
@decorator_function
def display_info(name, age):
print('display_info has the following arguments ({}, {})'.format(name, age))
display_info('Bob', 29)