Mechanism for If-statements with str in python
<p>Can I be sure that <code>''</code> always will be considered <code>False</code> while anything else isn't?</p>

<pre><code>&gt;&gt;&gt; if '':
...    print('bah')
...
&gt;&gt;&gt; if 'x':
...    print('bah')
...
bah
</code></pre>

<p>Why or why not? <strong>What mechanism in Python defines this behavior?</strong></p>

<p>If <code>''</code> is evaluated as <code>False</code>, why do I get this result:</p>

<pre><code>&gt;&gt;&gt; if '' == False:
...    print('bah')
...
&gt;&gt;&gt;
</code></pre>
