Steven D'Aprano writes:
On Wed, Mar 02, 2022 at 02:28:33AM +0100, Svein Seldal wrote:
for x in y if x in c: some_op(x)
What does this new syntax give us that we don't already have with this?
for x in y if x in c: some_op(x)
It would actually work! (missing colon ;-)
I see no new functionality here. Is the only advantage that you save one line and one indent level? Both are cheap.
It's arguably consistent with comprehension syntax, which one could argue makes learning either simpler if you already know the other. But I'm -0.5 on this change as needless churn, and -0.5 on it because I really don't want to invite the full comprehension syntax (with nested "in ... if" clauses) and without it it's still not the same, for a net "vote" of math.nextafter(-1,0).