It’s a pity Python doesn’t provide a None -coalescing operator . The ternary alternative is way more verbose and the or solution is simply not the same (as it handles all “falsy” values, not just None – that’s not always what you’d want and can be more error-prone).9 Kas 2011