[Tutor] Impossible Else as Exception

eryksun eryksun at gmail.com
Wed Apr 10 02:43:59 CEST 2013


On Tue, Apr 9, 2013 at 8:17 PM, Danny Yoo <dyoo at hashcollision.org> wrote:
>
> Going back to the original question: perhaps an assertion here would
> be sufficient.  Something like:
>
>     assert False, "Impossible situation"

Like "if __debug__" statements, assert statements are skipped by the
compiler if optimization is enabled. If you want an AssertionError
here even for optimized code, then explicitly raise
AssertionError('Impossible situation').


More information about the Tutor mailing list