The bool function is converted into the equivalent of integer 1 or 0.
You can use them as offsets to pick true and false values from a list:
A = [Z, Y][bool(X)] For example:
print( ['f', 't'][bool('')] ) print( ['f', 't'][bool('test')] )