What does the leading * do?
Tells Python to use the following iterable as the (remainder of the) argument list:
py> def f(x, y): ... print x, y ... py> f([1, 2]) Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: f() takes exactly 2 arguments (1 given) py> f(*[1, 2]) 1 2 py> f(1, [2]) 1 [2] py> f(1, *[2]) 1 2
Note that whenever the leading * is present, the following list gets expanded into the positional arguments of f -- x and y.
Steve -- http://mail.python.org/mailman/listinfo/python-list