title: try block inside while statement
body: <p>I'm just starting out with Python 2.7 and I don't understand why something is happening:</p>
  
  <p>In the following code, an embellished version of an example from the python 2.7.2 tutorial, I get an unexpected result:</p>
  
  <pre><code>while True:
      try:
          x = int(raw_input("Please enter a number: "))
          break
      except ValueError:
          print "Oops!  That was not a valid number.  Try again..."
      else:
          print 'Thanks,',x,'is indeed an integer'
      finally:
          print 'all done, bye'
  </code></pre>
  
  <p>When I put in an integer, the code ignores the <code>else:</code> statement and cuts straight to <code>finally:</code>.  Clearly it's something to do with the <code>while True:</code> at the top but why is it happening?</p>