Question: I was going through the python docs on simple assignment. I found below from the docs.  Assignment of an object to a target list, optionally enclosed in parentheses or square brackets, is recursively defined as follows. If the target list is a single target with no trailing comma, optionally in parentheses, the object is assigned to that target. Else: If the target list contains one target prefixed with an asterisk, called a “starred” target: The object must be an iterable with at least as many items as there are targets in the target list, minus one. The first items of the iterable are assigned, from left to right, to the targets before the starred target. The final items of the iterable are assigned to the targets after the starred target. A list of the remaining items in the iterable is then assigned to the starred target (the list can be empty). Else: The object must be an iterable with the same number of items as there are targets in the target list, and the items are assigned, from left to right, to the corresponding targets.  What I understood is that if the target list contains starred target then object, on RHS, must be iterable. So while assignment, python first unpacks the object and assigns the items as per the above rule and then rest of the values is assigned to the starred target. Now, Considering above I have kept only starred target and was expecting the values on RHS ( which is a tuple) to be assigned to starred target. However, Python gives syntax error for this line. I am still trying to understand where I am lacking as it is nowhere mentioned that I can't use starred target alone. *a=1,2,3  But Below works. Please explain why here alone why alone starred target is working here ? [*a] = 1,2,3 

Answer: You can instead add a comma to make the unpacking assignment to an explicit tuple: *a, = 1, 2, 3  as pointed out in PEP-3132:  It is also an error to use the starred expression as a lone assignment target, as in *a = range(5)  This, however, is valid syntax: *a, = range(5)   It is also pointed out in the same documentation that unpacking assignment to a list is semantically equivalent to unpacking assignment to a tuple:  For example, if seq is a sliceable sequence, all the following assignments are equivalent if seq has at least two elements: a, b, c = seq[0], list(seq[1:-1]), seq[-1] a, *b, c = seq [a, *b, c] = seq   You can also refer to the discussion with Guido van Rossum, the creator of Python, from the Python mailing list, for how the decision to disallow *a = range(5) was made:    Also, what should this do? Perhaps the grammar could disallow it? *a = range(5)   I say disallow it. That is ambiguous as to what your intentions are even if you know what '*' does for multiple assignment.  My real point was that the PEP lacks precision here. It should list the exact proposed changes to Grammar/Grammar. -- --Guido van Rossum (home page: http://www.python.org/~guido/)  as well as this follow-up discussion:    Also, what should this do? Perhaps the grammar could disallow it? *a = range(5)   I'm not so sure about the grammar, I'm currently catching it in the AST generation stage.  Hopefully it's possible to only allow this if there's at least one comma? In any case the grammar will probably end up accepting *a in lots of places where it isn't really allowed and you'll have to fix all of those. That sounds messy; only allowing *a at the end seems a bit more manageable. But I'll hold off until I can shoot holes in your implementation. ;-) -- --Guido van Rossum (home page: http://www.python.org/~guido/)