ABSTRACT

Traditionally a developer would choose between one of these two strategies when faced with runtime program errors. The first option, which is very popular, is not advisable if we want our program to be used by anyone besides ourselves. The second option, which is also known as Look Before You Leap (LBYL), is time consuming and may make code unreadable. The problem is ignored or each condition is verified where an error may occur and then he or she would write code in consequence. Errors detected during execution are called exceptions. An advantage of the exception system is that we don't have to limit ourselves to those provided by Python. In order to create an exception, we need to work with Object Oriented Programming (OOP), a topic that has not been covered yet. Since all exceptions derive from the Exception class, we can make our own exception by subclassing the Exception class.