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).



_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/CHLZRWY4Q3L7A23D4NUGE6KIRKWYG3JL/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to