0

This question is more of understanding how the * work in python.

How is the * used in python apart from multiplication, What causes this confusion from me is, I have seen function like this:

def func(*args, **kwargs):
    print(args, kwargs)

Which prints the all the positional arguments and keyword arguments Also I have seen this(which made me to ask this question)

import itertools
x_match = [[1], [23], [4]]

n = list(itertools.chain(*x_match))

I am guessing it's doing the same as *args from the the function above. And I have also seen it used function parameters as just "*"

I want to understand if it's sole purpose in all the examples above are just unpacking or there is something more to it.

0 Answers0