title: Python exception ordering
body: <p>Just curious, why does the following code</p>
  
  <pre><code>import sys
  class F(Exception):
      sys.stderr.write('Inside exception\n')
      sys.stderr.flush()
      pass
  
  sys.stderr.write('Before Exception\n')
  sys.stderr.flush()
  
  try:
      raise F
  except F:
      pass
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>Inside exception
  Before Exception
  </code></pre>
  
  <p>and not:</p>
  
  <pre><code>Before exception
  Inside Exception
  </code></pre>