On 17/06/2020 10:42, artem6191 wrote:
So yeah, we can "if <expression>: return", but why not?
Because without a decent reason otherwise, status quo ante wins.
When I was writing a lot of Perl, I used the "<stmt> if <cond>;" form quite a lot to start with. Partly that was the novelty of it, part was that it reads naturally in English, and part was that I was used to writing ARM assembler (and I do mean ARM, not Thumb) so applying condition codes to every line was a natural if misdirected thing to me. Once the novelty wore off, I found I only used that form when the statement needed serious thought (usually because of a regex) and the condition was an afterthought. For anything I actually cared about, I wanted the visible structuring with line breaks and all.
-- Rhodri James - Kynesim Ltd