Re:Clever code is probably the worst code you could write
by globular-toast on Wednesday May 22, 2024 @03:22AM
(#40438225)
But that would be a mistake if you need the branch to run for other falsely values like 0 or the empty string.
Re:Clever code is probably the worst code you could write
by sgarland on Wednesday May 22, 2024 @07:30AM
(#40439702)
In this imaginary example, yes, a False is likely to cause the same issues that None would. But as a sibling comment mentions, it’s not always desirable to drop the explicitness for syntactic sugar.
I find it visually clearer than the second example where the cause and effect are slightly separated, but I do agree there's an element of cleverness to it.