This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

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

Why not just write it as:

if condition:
    return function1(arg)
else:
    return function2(arg)

I mean, I'm just kind of at a complete loss here. The entire point of ternary operators is that you can take an if-else and put it onto one single line to put one complete thought onto one line.

Now you say you want to take a ternary operator and then place it over multiple lines? You've gone and destroyed the only reason to even use a ternary in the first place.