On 02/08/13 08:32, Jim Mooney wrote:

x = [idx, word for idx, word in S] #syntax error
# Why can I imply a tuple after the for, but not before?

How should Python interpret this?

As

x = [idx, (word for idx, word in S)]

Or

x = [(idx, word) for idx, word in S]

It's ambiguous.

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to