Comment Comment by bionoid Python also has "shorthand ternary" which uses and/or: a = bar and foo # "or None" is implied b = bar and foo or baz It does almost the same but not quite. In the latter example, if foo is falsey, it evaluates to "b = baz": b = bar ? (foo ? foo : baz) : baz parent bionoid 5 years ago