In Python how should I test if a variable is None, True or False
<p>I have a function that can return one of three things:</p>

<ul>
<li>success (<code>True</code>)</li>
<li>failure (<code>False</code>)</li>
<li>error reading/parsing stream (<code>None</code>)</li>
</ul>

<p>My question is, if I'm not supposed to test against <code>True</code> or <code>False</code>, how should I see what the result is. Below is how I'm currently doing it:</p>

<pre><code>result = simulate(open("myfile"))
if result == None:
    print "error parsing stream"
elif result == True: # shouldn't do this
    print "result pass"
else:
    print "result fail"
</code></pre>

<p>is it really as simple as removing the <code>== True</code> part or should I add a tri-bool data-type. I do not want the <code>simulate</code> function to throw an exception as all I want the outer program to do with an error is log it and continue. </p>
