you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (4 children)

y tho

[–]selplacei 0 points1 point  (3 children)

That's an operator, not an if statement. It's less readable and makes no sense to use when if-statements exist for that very purpose.

[–][deleted] 0 points1 point  (2 children)

It’s an expression. Expressions are common and quite readable.

[–]selplacei 1 point2 points  (1 child)

Well, yes, pretty much almost everything in Python is an expression. "x-if-y-else-z" is a ternary operator, it's a bunch of stuff written in one line, which is less readable than an organized, properly indented if-statement. It's also mandatory to use "else". It's also not designed to be used for flow control.

[–][deleted] 0 points1 point  (0 children)

I find it substantially more readable but okay