12.2. Python built-in exceptions
Python predefines several exceptions (Figure 12.1).
- AttributeError: when you attempt to
access a non-existing attribute (method or variable) of
an object.
- NameError: failure to find a global
name (module, ...)
- IndexError,
KeyError:
occurs when attempting to access
either an out-of-range index in a list or a non-existing key in a
dictionary
- TypeError: passing an inappropiate
value to an operation
- TabError,
IndentationError: two kinds of SyntaxError