exceptions and errors Flashcards

1
Q

exception tuple args

A

e.args

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

what str on exception object return

A

e.args[-1]

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

atribute for original exception if error occurs in the except block

A

__context__

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

how to make explicit chain error

A

raise MyException from e

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

which attribute is using for assosiation with error

A

__cause__

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

attribute which contains a refrence of traceback object

A

__traceback__

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

print traceback object

A

traceback.print_tb(e.__traceback__)

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

make assertion

A

assert condition [, message]

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

python flag to ignore assertions

A

-O

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