To make a function that accepts any number of arguments, you can use the * operator and then some variable name when defining your function. Some of Python's built-in functions work this way.
Ever seen **kwargs in a function definition? There's nothing special about the name "kwargs": it's the ** that's special. You can use Python's ** operator to define a function that accepts arbitrary keyword arguments.
If you see a function that has an asterisk (*) on its own with a comma after it, every argument after that point is a keyword-only argument (an argument which can only be specified by its name).
Tuple unpacking is great when you know the size of the iterable that you're unpacking, but you can even use it if you don't know the size of your iterable (by capturing remaining values).
In Python, you can unpack the items in an iterable into separate positional arguments in a function (sometimes called "variadic arguments"). This works even if you don't know how long the iterable is.
Have multiple iterables that you'd like to merge together into a new list? If you have just lists, you could concatenate. For other iterables, you can unpack your iterable into a new list instead.
Often seen as **kwargs, Python's double-asterisk syntax can be used for capturing arbitrary keyword arguments in function definitions.
My name is Trey Hunner. I publish new Python articles and screencasts every week through Python Morsels. If you want to learn something new about Python every week, join Python Morsels!