Unpacking Tuples

Joel Davis callmeclaudius at gmail.com
Mon Nov 30 03:17:38 EST 2009


I hate to post such a simple Q and A here, but I seriously can't find
it anywhere. Python (unsure of starting with which version) enables
the remainder of the tuple to be placed in a "catch-all", for example:


>> myTuple = (1,2,3,4)
>> varOne, varTwo, *remaindingTuple = myTuple.

where the values left unpacked get thrown into a tuple referenced to
by "remaindingTuple" I included the asterix because it seems like I
remember that being the operator that specifying the tuple's dumping
ground. Which brings me to my two questions: 1) what's the syntax for
this operation 2) what version does it start with?



More information about the Python-list mailing list