I am trying to unpack set of phone numbers from a sequence, python shell in turn throws an invalid syntax error. I am using python 2.7.1. Here is the snippet
This new syntax was introduced in Python 3. So, it'll raise error in Python 2.
Related PEP: PEP 3132 -- Extended Iterable Unpacking
name, email, *phone_numbers = user_record
Python 3:
>>> a, b, *c = range(10)
>>> a
0
>>> b
1
>>> c
[2, 3, 4, 5, 6, 7, 8, 9]
Python 2:
>>> a, b, *c = range(10)
File "", line 1
a,b,*c = range(10)
^
SyntaxError: invalid syntax
>>>