What do * and ** before function arguments mean?
Published:
The use varies whether it used in function header or while calling any function.
Inside function header
The *
and **
inside function header mean:
*
collects all the positional arguments in a list or tuple.**
collects all the keywords arguments in a dictionary.
Inside function call
The *
and **
inside function header mean:
*
unpacks list or tuple into positional arguments.**
unpacks a dictionary and assigns as keyword arguments.