title: Python - Try/Except, what is ok and what is wrong?
body: <p>I have to deal with a large quantity of try/except. I'm in doubt about the right way of doing it.</p>
  
  <p>Option 1:</p>
  
  <pre><code>inst = Some(param1, param2)
  try:
      is_valid = retry_func(partial(inst.some_other), max_retry=1)
  except RetryException, e:
      SendMail.is_valid_problem(e)
  
  if is_valid:
      print "continue to write your code"
      ...
      *** more code with try/except ***
      ...
  </code></pre>
  
  <p>Option 2:</p>
  
  <pre><code>inst = Some(param1, param2)
  try:
      is_valid = retry_func(partial(inst.some_other), max_retry=1)
      if is_valid:
          print "continue to write your code"
          ...
          *** more code with try/except ***
          ...
  except RetryException, e:
      SendMail.is_valid_problem(e)
  </code></pre>
  
  <p>In the Option 1, even is the exception is raised, "is_valid" will be tested and I don't need that.</p>
  
  <p>In the Option 2, is what I think is correct but the code will look like a "callback hell".</p>
  
  <p>What option should I choose <em>or</em> what option is the correct one?</p>