title: Boolean testing a list in Python
body: <p>I was testing a list to see if it's empty or not. Normally I use len(list) == 0 and I vaguely remembered reading a little while ago that the correct way to test if a list is empty was whether it was True or false.</p>
  
  <p>So I tried list is False, and that returned False. Maybe I'm suppose to be using == ?
  Nope, that also returned false. list is True, returned false as did list == True.</p>
  
  <p>Now I'm confused so I do a quick google and end up at: <a href="https://stackoverflow.com/questions/53513/python-what-is-the-best-way-to-check-if-a-list-is-empty">Best way to check if a list is empty</a> </p>
  
  <p>The top answer is:</p>
  
  <pre><code>if not a:
      print "List is empty"
  </code></pre>
  
  <p>So I search around some more and end up in the python manual where 4.1 states:</p>
  
  <p>Any object can be tested for truth value, for use in an if or while condition or as operand of the Boolean operations below. The following values are considered false:</p>
  
  <p>any empty sequence, for example, '', (), [].</p>
  
  <p>Now I'm plain confused. If I test a list as if not list, it works fine. But if an empty list is false, then why can't I just do if list is False or if list == False?</p>
  
  <p>Thanks</p>