title: Making Python's `assert` throw an exception that I choose
body: <p>Can I make <code>assert</code> throw an exception that I choose instead of <code>AssertionError</code>?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I'll explain my motivation: Up to now, I've had assertion-style tests that raised my own exceptions; For example, when you created a <code>Node</code> object with certain arguments, it would check if the arguments were good for creating a node, and if not it would raise <code>NodeError</code>.</p>
  
  <p>But I know that Python has a <code>-o</code> mode in which asserts are skipped, which I would like to have available because it would make my program faster. But I would still like to have my own  exceptions. That's why I want to use assert with my own exceptions.</p>