If anything, I'd say this is worse. Assuming for a moment that it couldn't be simplified further as you do in the article, I think having the else block is preferable because it puts both branches of the decision on the same indentation level and makes it clear that it's either this or that.
If you want to reduce writing and you only have single-statement branches, you could just do
If anything, I'd say this is worse. Assuming for a moment that it couldn't be simplified further as you do in the article, I think having the else block is preferable because it puts both branches of the decision on the same indentation level and makes it clear that it's either this or that.
If you want to reduce writing and you only have single-statement branches, you could just do
or even put it on 2 lines if the
if-condition was a bit shorter.