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)