0

What is the pythonic way to write a ternary operator like this in the shortest possible way?

(x!=null)? x.something:0; 

I want to use something like

y = x.something or 0

but that will check references in a way such that

x.y.z = None whenever x or y are None
monolith
  • 1,401
  • 1
  • 10
  • 19

0 Answers0