title: Python warnings come after thing trying to warn user about
body: <p>I am using warnings in object code to alert users that something has happened but not halt the code.  Below is a simple mockup based on the more complex scenarios I am encountering in my real code:</p>
  
  <pre><code>from warnings import warn
  class myClass(object):        
      def __init__(self, numberArg):
  
          if numberArg &gt; 1000:
              self._tmpTxt = "That's a really big number for this code." + \
                             "Code may take a while to run..."
              warn("\n%s %s" %(numberArg, self._tmpTxt))
              print("If this were real code:")
              print("Actions code takes because this is a big number would happen here.")
  
          print("If this were real code, it would be doing more stuff here ...")
  
  mc1 = myClass(1001)
  </code></pre>
  
  <p>In my real code, when I instantiate the class which executes <code>__init__(self, numberArg)</code>, the warning is output at the end after all the processing that follows the warning is done.  Why does this happen?  </p>
  
  <p>More importantly, is there a way to ensure the warning is output first and then the rest of my code runs and delivers its output?  </p>
  
  <p>As with the example provided here, the desired effect is to alert the user what is going to happen before it happens, not afterwards, and deliver the output like a warning with warning format.</p>
  
  <p>Note:  This problem was encountered using Python 2.7 on iPython/Jupyter on a Windows 7 environment</p>