Associativity of an if expression in Python

22 views Asked by At

In Python language, which is the associativity of an if expression: left or right? For example if we write this:

<exp1> if <exp2> else <exp3> if <exp4> else <exp5>

what is the corresponding form?

[<exp1> if <exp2> else <exp3>] if <exp4> else <exp5>

or:

<exp1> if <exp2> else [<exp3> if <exp4> else <exp5>]
0

There are 0 answers