On 12/30/2016 2:37 PM, Jason Friedman wrote:

Now, this puzzles me:

[x,y for a in data]
  File "<stdin>", line 1
    [x,y for a in data]
           ^
SyntaxError: invalid syntax

I believe that python begins to parse this as
[x, (y for a in data)], a list of 2 items,
except that the required () are missing.
Notice that the ^ is under the r of 'for'.
"y for" is not a legal beginning of a list item.
Most tuples need ()s for proper grouping.



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to