I know that it expands function arguments, but if I try something like this in Python 2:
x = [1,2,3]
print *x # SyntaxError: invalid syntax
print [*x] # SyntaxError: invalid syntax
So it appears that I am missing something about what * exactly does?
print
is not a function in python 2, it's a statement. And a list literal isn't a function either.[*x]
is legal syntax... But only in Python 3.