python How to call ob1.fun1.fun2 and handle ob1.fun1 as none?
<p>I tried to use the following code, but looks like ugly</p>

<pre><code>tmp = ob1.fun1
result = None
if tmp is not None:
   global result
   result = tmp.fun2
</code></pre>

<p>Is there a better way to do this?</p>

<p>How about:</p>



<pre><code>if t.fun1 is not None:
  result = t.fun1.fun2
else:
  result = None
</code></pre>

python