title: Valid syntax in both Python 2.x and 3.x for raising exception?
body: <p>How can I port this code to Python 3 so that it would run in both, Python 2 and Python3?</p>
  
  <pre><code>raise BarException, BarException(e), sys.exc_info()[2]
  </code></pre>
  
  <p>(copied from <a href="http://blog.ionelmc.ro/2014/08/03/the-most-underrated-feature-in-python-3/" rel="noreferrer">http://blog.ionelmc.ro/2014/08/03/the-most-underrated-feature-in-python-3/</a>)</p>
  
  <p><strong>Bonus question</strong><br>
  Does it make sense to do something like</p>
  
  <pre><code>IS_PYTHON2 = sys.version_info &lt; (3, 0)
  
  if IS_PYTHON2:
      raise BarException, BarException(e), sys.exc_info()[2]
      # replace with the code that would run in Python 2 and Python 3 respectively
  else:
      raise BarException("Bar is closed on Christmas")
  </code></pre>