On 04/15/2013 02:35 PM, Tobiah wrote: > On 04/15/2013 11:25 AM, Gnarlodious wrote: >> Say I have a tuple I want to expand assigning to variables: >> >> tup = *func() > > What is the asterisk for? I assume it's a python 3 > thing, because I get a syntax error, but I'm having > trouble Googling it.
No it's not. It's a tuple unpack operator. It's commonly used in this context: def func1(*args, **kwargs): #func1 can take variable args # do stuff func2( *args ) #unpack the variable args and pass them to func2 func3( *args ) func4( *args, **kwargs) def func2( a, b, c): d = a + b + c def func3 ( *args ): pass def func4 ( *args, **kwargs): pass func1(1,2,3) -- http://mail.python.org/mailman/listinfo/python-list