On the contrary, the ternary operator makes the specific operation (setting ONE variable) more explicit, and ensures you only set one var. Consider:
if a == 1: foo = "PASS" else: foo = "FAIL"
and
foo = (A == 1) ? "PASS" : "FAIL"
Why repeat the foo (and risk an error by mistyping it the second time, especially in a dynamic language or with type inference)?
And they add the same amount of cyclomatic complexity (not that you implied otherwise, just sayin').
On the contrary, the ternary operator makes the specific operation (setting ONE variable) more explicit, and ensures you only set one var. Consider:
if a == 1: foo = "PASS" else: foo = "FAIL"
and
foo = (A == 1) ? "PASS" : "FAIL"
Why repeat the foo (and risk an error by mistyping it the second time, especially in a dynamic language or with type inference)?
And they add the same amount of cyclomatic complexity (not that you implied otherwise, just sayin').