Given the following trivial function:
def func(x):
return x if True else x, x
Why is func(1) returns the tuple (1, 1), even if the desired results would be the identity?
However, note that the following:
def func(x):
return x if True else (x, x)
Does return the desired integer type. Can anyone explain such behavior and why this happens?
(x if True else x), xx if True else x, xis the same as((x if True else x), x).return (x if True else x), x. Sould have noticed. Thanks