which they inherit built-in exception classes didn' really pull the prior section' examples out of thin air all built-in exceptions that python itself may raise are predefined class objects moreoverthey are organized into shallow hierarchy with general superclass categories and specific subclass typesmuch like the prior section' exceptions class tree in python xall the familiar exceptions you've seen ( syntaxerrorare really just predefined classesavailable as built-in names in the module named builtinsin python xthey instead live in __builtin__ and are also attributes of the standard library module exceptions in additionpython organizes the built-in exceptions into hierarchyto support variety of catching modes for examplebaseexceptiontopmost rootprinting and constructor defaults the top-level root superclass of exceptions this class is not supposed to be directly inherited by user-defined classes (use exception insteadit provides default printing and state retention behavior inherited by subclasses if the str built-in is called on an instance of this class ( by print)the class returns the display strings of the constructor arguments passed when the instance was created (or an empty string if there were no argumentsin additionunless subclasses replace this class' constructorall of the arguments passed to this class at instance construction time are stored in its args attribute as tuple exceptionroot of user-defined exceptions the top-level root superclass of application-related exceptions this is an immediate subclass of baseexception and is superclass to every other built-in exceptionexcept the system exit event classes (systemexitkeyboardinterruptand genera torexitnearly all user-defined classes should inherit from this classnot baseex ception when this convention is followednaming exception in try statement' handler ensures that your program will catch everything but system exit eventswhich should normally be allowed to pass in effectexception becomes catchall in try statements and is more accurate than an empty except arithmeticerrorroot of numeric errors subclass of exceptionand the superclass of all numeric errors its subclasses identify specific numeric errorsoverflowerrorzerodivisionerrorand floating pointerror lookuperrorroot of indexing errors subclass of exceptionand the superclass category for indexing errors for both sequences and mappings--indexerror and keyerror--as well as some unicode lookup errors built-in exception classes