English
Summary
Conclusions
An exception carries information about a failed operation to a level that can make a decision. Specific handlers, short try blocks, and explicit causes preserve that information. A log explains the execution history, while a debugger shows program state at a selected point. Reference examples establish that a formula is correct; the absence of a traceback does not.
Self-check questions
- How do syntax errors, logic errors, and runtime exceptions differ?
- Which line should you start with when reading a traceback?
- Why does
except Exceptionnot catch Ctrl+C? - How does handler order affect the result?
- When does
elserun, and when doesfinallyrun? - What is the syntax for several types in Python 3.14, and when are parentheses needed?
- What does
argscontain, and why should you avoid comparing error messages? - How do
raise,raise error, andraise ... from errordiffer? - Why have a separate domain-error type?
- How does
except*differ from ordinaryexcept? - How does
add_notehelp locate an invalid field? - Which checks must not use
assert? - When is
logger.exceptionmore useful thanlogger.error? - What hypothesis does a conditional breakpoint test?
- How do you reproduce a PyCharm state inspection using
pdb?
Useful links
- https://docs.python.org/3.14/tutorial/errors.html.
- https://docs.python.org/3.14/library/exceptions.html.
- https://docs.python.org/3.14/reference/compound_stmts.html#the-try-statement.
- https://peps.python.org/pep-0758/.
- https://docs.python.org/3.14/howto/logging.html.
- https://docs.python.org/3.14/library/pdb.html.
- https://www.jetbrains.com/help/pycharm/debugging-code.html.