Title: Theory / Important / CS / Programming / Python / Manual{ / 8 Exception
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning some_instruction
On every note of this deck, unless a note says otherwise:
Page: https://docs.python.org/3/tutorial/errors.html

Name: A syntax error
Definition: An error concerning the syntax of Python
Page: https://docs.python.org/3/tutorial/errors.html
Chapter: 8
Section: 1
Name2: Parsing error

Instruction: except v as x:
buz
Effect: state that the catched exception, of type v, is denoted as x in buz
Language: Python
Chapter: 8
Section: 3

Instruction: raise v
Effect: Raise the exception v()
Language: Python
Chapter: 8
Section: 4
Variables: v an exception class

Instruction: raise v
Effect: Raise the exception v
Language: Python
Chapter: 8
Section: 4
Variables: v an exception instance

Instruction: raise
Effect: Raise the exception catched
Language: Python
Context: In an except clauze
Chapter: 8
Section: 4

Question: How to declare a personalized exception.
Answer: Declare a class heriting from Exception
Page: https://docs.python.org/3/tutorial/errors.html
Chapter: 8
Section: 5

Instruction: After some try foo except(s) ..
finally:
bar
Effect: Execute foo,
Execute the code according to except/else
Execute bar even if break/return/continue would normally change the flow
If some exception was raised and not catched, raise it again
Language: Python
Chapter: 8
Section: 6

Instruction: with foo as x:
bar
Effect: Execute foo
Assign its value to x
Execute bar with x assigned as above
Call the cleanup of foo
Language: Python
Chapter: 8
Section: 7

Instruction: try:
foo
except v_1:
bar_1
...
except v_n:
bar_n
Effect: Execute foo,
If an exception E is raised (and not catched) in foo,
if E is a subtype of v_i or of an element of the tuple v_i, with i minimal:
bar_i is executed
else:
E is raised
Language: Python
Chapter: 8
Section: 3

Instruction: try:
foo
except v_1:
bar_1
...
except v_n:
bar_n
except:
bar
Effect: Execute foo,
If an exception E is raised (and not catched) in foo,
if E is a subtype of v_i or of an element of the tuple v_i, with i minimal:
bar_i is executed
else:
bar is raised
Language: Python
Chapter: 8
Section: 3

Instruction: After some try foo except(s) ...
else:
buz
Effect: Execute foo,
If no exception occurred during foo, buz is executed
Language: Python
Chapter: 8
Section: 3