Exceptions Flashcards

1
Q

AssertionError

A

should never raise yourself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Try Except

A

try:
pass
except Exception as e:
pass
else:
pass
finaly:
pass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Raise

A

raise Exception(“message”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Assert

A

assert [condition], [error message]
error message optional

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Finally

A

executes after return

cleanup

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Custom Exception

A

class CustomException (Exception):
“"”Docstring”””

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Multiple Exceptions

A

except (Type1, Type2) as e:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

BaseException

A

base class of exceptions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly