Quote:
http://stackoverflow.com/questions/5239856/foggy-on-asterisk-in-python
Basically, it flattens the list the splat is before (or in this case, a variable that dereferences to a list).
Here's an rip of one of the examples at said source as I'm too lazy to write out my own right now.
Without me retyping, here's an answer on stackoverflow.
http://stackoverflow.com/questions/5239856/foggy-on-asterisk-in-python
Basically, it flattens the list the splat is before (or in this case, a variable that dereferences to a list).
Here's an rip of one of the examples at said source as I'm too lazy to write out my own right now.
Code:
>>> def foo(a, b=None, c=None):
... print a, b, c
...
>>> foo([1, 2, 3])
[1, 2, 3] None None
>>> foo(*[1, 2, 3])
1 2 3
>>> def bar(*a):
... print a
...
>>> bar([1, 2, 3])
([1, 2, 3],)
>>> bar(*[1, 2, 3])
(1, 2, 3)