Python Glossary Русский

Python 3.7+Built-in functionsterm

breakpoint

debugging

Drops into the built-in pdb debugger at the point of the call. Python 3.7+. The behavior can be overridden through PYTHONBREAKPOINT.

Syntax

breakpoint()

The classic accident is a forgotten breakpoint() in a submitted solution: the program drops into the debugger and starts consuming the test input as pdb commands, then dies or hangs until the timeout. Setting PYTHONBREAKPOINT=0 disables every breakpoint call without editing a single line, and the same variable can point at a different debugger instead of pdb.

Examples

# breakpoint() — вставляет точку останова
# Устанавливается через PYTHONBREAKPOINT env
import os
os.environ['PYTHONBREAKPOINT']='0'  # отключить
# breakpoint()  # остановит программу и откроет отладчик pdb
print('Debugging would start here')  # → Debugging would start here

See also

Open in the full glossarydocs.python.orgReport an inaccuracy