Antoine Rozo wrote:
I think this syntax is very hard to read because the yielding-expression can be anywhere in the block and there is nothing to identify it.
Would you feel better if `yield` was always required?
Even in your examples I can't figure out which expression will be used.
For almost all the examples I've provided a corresponding equivalent in the current syntax, so are you saying that you're still confused now or that you can't figure it out until you look at the 'answer'?
What if I call a function somewhere in the block?
If that function is the whole statement and there is no other expression statement in the comprehension, it will be yielded. I can't tell if there's more to your question.
Can't you just use generators + list/set/dict constructors when you need complex statements?
I can, but I've explained at length why that's not as good.