title: Is it correct to mix exception handling with boolean logic?
body: <p>I have code which can either raise an exception or return a <code>True</code>or a <code>False</code>. I would like to run the same code </p>
  
  <ul>
  <li>either when the exception is raised</li>
  <li>or when the function returns a <code>True</code></li>
  </ul>
  
  <p>I tried to put the condition in the <code>except</code> clause and it works:</p>
  
  <pre><code>def fun(s1, s2):
      if s1:
          raise IndexError
      else:
          return s2
  
  try:
      a = fun(True, True)
  except IndexError or a:
      print("error")
  </code></pre>
  
  <p>I have not seen such construction in the documentation - is it correct? </p>