Friday 20 July 2018

Python Exception Class

Cited from the book "Python How to Program"

""
All exceptions inherit from base class Exception and are defined in module exceptions. Python automatically places all exception names in the built-in namespace, so programs do not need to import the exceptions module to use exceptions. Python defines four primary classes that inherit from Exception -- SystemExit, StopIteration, Warning and StandardError. Exception SystemExit, when raised and left uncaught, terminates program execution. If an interactive session encounters an uncaught SystemExit exception, the interactive session terminates. Python uses exception StopIteration to determine when a for loop reaches the end of its sequence. Python uses
Warning exceptions to indicate that certain elements of Python may change in the future. StandardError is the base class for all Python error exceptions (e.g., ValueError and ZeroDivisionError).
""




No comments:

Post a Comment