DEV Community

Discussion on: Advanced Python: for more attractive code

Collapse
 
detinsley1s profile image
Daniel Tinsley

I think it depends on how complicated the comprehension or the ternary expression is. If it's hard to comprehend, then a loop or an if...elif...else statement would be better, but if it's a simple statement, then a comprehension or ternary expression is just as good and is more Pythonic.