Python *args: Collecting positional arguments into a tuple

Python *args: Collecting positional arguments into a tuple

Classic use of Python’s *args:

def mysum(*args):
    total = 0
    for n in args:
        total += n
    return total

Invoke it with separate int arguments:

mysum(10, 20, 30, 40, 50)

and *not* with a list containing ints:

mysum([10, 20, 30, 40, 50])  # Error!