We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Meaning, if you have a function which takes multiple input arguments, say func(a,b,c); instead of passing them seperately, you can pack them in a list, args = [a,b,c]; and pass this list to your function, func(*args)
And How does your function know that the received argument (args) is a packed list? It'll when you supply unpack argument '*'
Note, operator '**', when used on a dictionary, returns its keys.
Print Function
You are viewing a single comment's thread. Return to all comments →
It is called unpacking operator.
Meaning, if you have a function which takes multiple input arguments, say func(a,b,c); instead of passing them seperately, you can pack them in a list, args = [a,b,c]; and pass this list to your function, func(*args)
And How does your function know that the received argument (args) is a packed list? It'll when you supply unpack argument '*'
Note, operator '**', when used on a dictionary, returns its keys.
Source: https://docs.python.org/2/tutorial/controlflow.html#unpacking-argument-lists