How to unpack tuple of length n to m<n variables [duplicate]
This question already has an answer here: Extended tuple unpacking in Python 2 4 answers In Python 3 I can do the following (see also PEP3132 on Extended Iterable Unpacking): a, *b = (1, 2, 3) # a = 1; b = (2, 3) What can I do to achieve the same similarly elegant in Python 2.x? I know that I could use single element access and slicing operations, but I wonder if there is a more pythonic way. My code so far: a, b = (1, 2, 3)[0], (1, 2, 3)[1:] # a = 1; b = (2, 3) moooeeeep I found out that the related PEP3132 gives some examples for Python 2.x as well: Many algorithms require splitting a