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
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to