Handling Exceptions

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

19 Terms

1
New cards

Exception

An event that disrupts the normal flow of a program's instructions, causing an error or exceptional condition.

2
New cards

Catching exceptions

The process of handling an exception when it occurs, preventing the program from crashing.

3
New cards

Raising exceptions

The action of triggering an exception in a program, typically to indicate an error or unexpected situation.

4
New cards

Assertion

A statement that raises an AssertionError if a specified condition is not met.

5
New cards

KeyError

An exception raised when trying to access a non-existent key in a dictionary.

6
New cards

ValueError

An exception raised when a built-in operation or function receives an argument that has the right type but an inappropriate value.

7
New cards

TypeError

An exception raised when an operation or function is applied to an object of inappropriate type.

8
New cards

NameError

An exception raised when a local or global name is not found.

9
New cards

finally clause

A block of code that is guaranteed to execute after the try and except blocks, regardless of whether an exception occurred.

10
New cards

User-defined Exception

A custom exception created by deriving classes from built-in exception classes in Python.

11
New cards

Handling Unusual Situations

The practice of managing unexpected errors or exceptions that arise during program execution.

12
New cards

try...except block

A code structure in Python used to catch and handle exceptions, ensuring that the program can continue running.

13
New cards

Raising Exception To Caller

The process of propagating an error from a callee function back to the calling function.

14
New cards

ZeroDivisionError

An exception raised when an attempt is made to divide by zero.

15
New cards

Traceback

A report containing the function calls made in your code at a specific point, particularly during an exception.

16
New cards

Clean up operations

Tasks performed at the end of a program or method execution to ensure resources are properly released, often done in a finally block.

17
New cards

Exception Class

A base class for all exceptions in Python, from which built-in exceptions and custom exceptions are derived.

18
New cards

args property

An attribute of exception instances that contains the arguments passed to the exception; usually provides additional information about the error.

19
New cards

assert statement

A statement used to validate conditions in code, raising an AssertionError if the condition evaluates to false.