About Truthiness and the Booleans True and False
<p>My environment is : ubuntu 16.04  &amp; python 2.7.12.</p>

<p>I read the documentation and found out that <code>''</code>, <code>()</code>, <code>[]</code>, <code>{}</code>, and <code>None</code> are all considered <code>False</code> by default.</p>

<p>But I don't understand what's going on in the examples below:</p>

<pre class="lang-none prettyprint-override"><code>Python 2.7.12 (default, Jul  1 2016, 15:12:24)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; a=''
&gt;&gt;&gt; a==False
False
&gt;&gt;&gt; a==True
False
&gt;&gt;&gt; a=bool(a)
&gt;&gt;&gt; a==False
True
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt;
&gt;&gt;&gt; a="abcdefg"
&gt;&gt;&gt; a==True
False
&gt;&gt;&gt; a==False
False
&gt;&gt;&gt; a=bool(a)
&gt;&gt;&gt; a==True
True
&gt;&gt;&gt;
</code></pre>

<p>I want get the right result and it appears I must use the <code>bool()</code> function to do so.
Is that correct and why?</p>

<p>The <a href="https://docs.python.org/2/library/stdtypes.html" rel="nofollow">docs</a> say:</p>

<blockquote>
  <p>Any object can be tested for truth value, for use <strong>in an if or while condition or as operand of the Boolean operations</strong> below.</p>
</blockquote>

<p>In other words, this works for <code>a = ''</code>:</p>

<pre><code>if a:
    print "this won't print"
</code></pre>

<p>But <code>a</code> is still not <em>equal to</em> <code>False</code>.</p>

python