I love the do_stuff if cond syntax in Ruby and in perl. It's very natural to real, much more to follow than if cond: do_stuff
But still I don't think that it is enough to demand a language change.
Something near this is to have a default of none for
A if B else None
So we can ommit the else None part, but this goes against the explicit is better than implicit
Em qua, 17 de jun de 2020 07:42, Paul Moore email@example.com escreveu:
On Wed, 17 Jun 2020 at 10:44, artem6191 firstname.lastname@example.org wrote: >
So yeah, we can "if <expression>: return", but why not?
That's the wrong question. The correct question is "why is this needed, and is the need sufficiently pressing to justify the change to the language?"
You're talking about allowing "return EXPR if CONDITION" as an exact equivalent of "if CONDITION: return EXPR". There isn't even a benefit of "it saves a line of code", so it's very hard to see a justification.
Python-ideas mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/PHB2VW... Code of Conduct: http://python.org/psf/codeofconduct/