[Tutor] Impossible Else as Exception
Jordan
wolfrage8765 at gmail.com
Tue Apr 9 21:22:13 CEST 2013
I want to know what exception should be raised if there is a bug in my
code that allows an else statement to be triggered, because the else
condition in my code should be impossible, unless there is an error in
my code. What exception should I raise so that if my code is wrong it
will raise an exception which will give me a trace back? Which would be
most Pythonic?
Example:
if condition is 1:
do something with 1
elif condition is 2:
do something with 2
else: # Impossible unless the code above is flawed.
Raise Exception
More information about the Tutor
mailing list