DEV Community

Discussion on: TIL sub for A if X else B

Collapse
 
bezirganyan profile image
Grigor Bezirganyan

I would avoid doing the second option, as the first one is more readable. You can basically read it like a sentence, while in the second one it may not be clear if it has to return one of the options or a boolean, when you are not familiar with the syntax.

According to the zen of python:

Readability counts