Compressing `x if x else y` statement in Python
Compressing `x if x else y` statement in Python Question: I’m quite acquainted with Python’s ternary operator approach: value = foo if something else bar My question is very simple: without prior assignments, is there anyway to reference the term being evaluated in (if …) from one of the return operands (… if or else …
Total answers: 3