Kent Johnson wrote:
If you mean for j to be a list of foobar(item) then use
j=[foobar(item) for item in x]
The first part of the list comp can be any valid expression.
Does that mean that there are invalid expressions? I'd enjoy seeing an example.
I suppose if it's an expression, it must be valid, eh? Otherwise it's something else.

I don't think I entirely agree... What about "x === item" It's certainly not a statement, and I would wager that Python was in the middle of its expression parsing code when it threw the SyntaxError. (Or how about "x == item ="?) Perhaps someone more in touch with the compiler internals will chip in here.


It is an interesting philosophical question, though.

Later,
Blake.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to