title: Python if statement efficiency
body: <p>A friend (fellow low skill level recreational python scripter) asked me to look over some code. I noticed that he had 7 separate statements that basically said.</p>
  
  <pre><code>if ( a and b and c):
      do something
  </code></pre>
  
  <p>the statements a,b,c all tested their equality or lack of to set values. As I looked at it I found that because of the nature of the tests, I could re-write the whole logic block into 2 branches that never went more than 3 deep and rarely got past the first level (making the most rare occurrence test out first).</p>
  
  <pre><code>if a:
      if b:
          if c:
      else:
          if c:
  else:
      if b:
          if c:
      else:
          if c:
  </code></pre>
  
  <p>To me, logically it seems like it should be faster if you are making less, simpler tests that fail faster and move on.
  My real questions are</p>
  
  <p>1) When I say if and else, should the if be true, does the else get completely ignored? </p>
  
  <p>2) In theory would</p>
  
  <p>if (a and b and c)</p>
  
  <p>take as much time as the three separate if statements would? </p>