COMPSCI 61A Lecture Notes - Lecture 25: Stack Trace, Exception Handling
zogo39484755 and 6 others unlocked
22
COMPSCI 61A Full Course Notes
Verified Note
22 documents
Document Summary
Midterm 2 scores and solutions will be released wednesday night. Completing the online participation form by wednesday 10/26 @ 11:59pm. A function receives an argument value of an improper type. Some resource (such as a le) is not available. A network connection is lost in the middle of data transmission. Exception: a built-in mechanism in a programming language to declare and respond to exceptional conditions. Python raises an exception whenever an error occurs. Exceptions can be handled by the program, preventing the interpreter from halting. Unhandled exceptions will cause python to halt execution and print a stack trace. If f calls g and g calls h, exceptions can shift control from h to f without waiting for g to return. Exception handling tends to be slow, so it is not used in the standard approach to a program (only non-standard situations) Assert statements raise an exception of type assertionerror.