title: nested try/except in Python
body: <pre><code>try:
    commands
    try:
      commands
      try:
        commands
        try:
          commands
        except:
          commands
          return to final commands
      except:
        commands
        return to final commands
    except:
      commands
      return to final commands
  except:
    commands
  
  final commands
  </code></pre>
  
  <p>Which instruction have I to write in place of <code>return to final commands</code> to make that any <code>except</code> returns to the top-level instructions following the outer try? And is it an acceptable structure?</p>
  
  <p>Edit: Here is a toy example (I know I can do it using <code>if</code>s, it's only an example; suppose you have to write it using <code>try</code>/<code>except</code>).</p>
  
  <pre><code># calculate arcsin(log(sqrt(x)-4))
  x = choose one yourself
  try
    x1=sqrt(x)
    return to final message
    try
      x1=log(x1-4)
      return to final message
      try
        x2=arcsin(x1)
        return to final message
      except
        message="Impossible to calculate arcsin: maybe an argument outside [-1,+1]?"
    except
      message="Impossible to calculate logarithm: maybe a not positive argument?"
  except
    message="impossible to calculate square root: maybe a negative argument?" 
  final message:
  print message
  </code></pre>