title: Do we use try,except in every single function?
body: <p>Should we always enclose every function we write with a  <code>try...except</code>  block?
  I ask this because sometimes in one function we raise <code>Exception</code>, and the caller that calls this function doesn't have exception</p>
  
  <pre><code>def caller():
     stdout, stderr = callee(....)
  
  
  def callee():
     ....
      if stderr:
         raise StandardError(....)
  </code></pre>
  
  <p>then our application crash. In this obvious case, I am tempted to enclose callee and caller with <code>try..except</code>.</p>
  
  <p>But I've read so many Python code and they don't do these <code>try..block</code> all the time.</p>
  
  <hr>
  
  <pre><code>def cmd(cmdl):
      try:
          pid = Popen(cmdl, stdout=PIPE, stderr=PIPE)
      except Exception, e:
          raise e
      stdout, stderr = pid.communicate()
      if pid.returncode != 0:
          raise StandardError(stderr)
      return (stdout, stderr)
  
  def addandremove(*args,**kwargs):
      target = kwargs.get('local', os.getcwd())
      f = kwargs.get('file', None)
      vcs = kwargs.get('vcs', 'hg')
  
      if vcs is "hg":
          try:
              stdout, stderr = cmd(['hg', 'addremove', '--similarity 95'])
          except StandardError, e:
              // do some recovery
          except Exception, e:
              // do something meaningful
      return True
  </code></pre>
  
  <p>The real thing that bothers me is this:</p>
  
  <p>If there is a 3rd function that calls <code>addandremove()</code> in one of the statements, do we also surround the call with a try..except block? What if this 3rd function has 3 lines, and each function calls itself has a try-except? I am sorry for building this up. But this is the sort of problem I don't get.</p>