Hi i have several lines of python code, which confuses me:
def apply_async(func, args,*, callback):
# Compute the result
result = func(*args)
# Invoke the callback with the result
callback(result)
def print_result(result):
print('Got:', result)
def add(x, y):
return x + y
apply_async(add, (2, 3), callback=print_result)
I understand that to write a function that accepts any number of positional arguments, use a * argument.
But i couldn't understand why *
appear ater args
.
and then *args
can represent the tuple (2,3)
in this example?