samuelbrody1249 :
What are all the places that (kw)arg unpacking can be used?
For example:
>>> a={1:2}
>>> b={3:4}
# ok
>>> {**a,**b}
{1: 2, 3: 4}
# ok
>>> [*a]
>>> [1]
# error
>>> (*a)
SyntaxError: can't use starred expression here
What are all the 'rules' that starred-expressions abide by?
blhsing :
Unpacking works in a tuple too. However, a single-item tuple (also known as a singleton) has to include a comma at the end of the expression enclosed in the parentheses, or else the parentheses would be treated as simple grouping, so do instead:
(*a,)