title: Where to put exception handling in python
body: <p>When using try/except blocks in Python, is there a recommendation to delegate it to any methods that might raise an exception, or to catch it in the parent function, or both?</p>
  
  <p>For example, which of the following is preferred?</p>
  
  <pre><code>def my_function():
      s = something.that.might.go_wrong()
      return s
  
  def main():
      try:
          s = my_function()
      except Exception:
          print "Error"
  </code></pre>
  
  <p>or</p>
  
  <pre><code>def my_function():
      try:
          s = something.that.might.go_wrong()
          return s
      except Exception:
          print "Error"
  
  def main():
      s = my_function()
  </code></pre>
  
  <p>PEP 8 seems to be quiet on the matter, and I seem to find examples of both cases everywhere.</p>