Built-in Functions and Types
breakpoint()
Request a debugger stop through sys.breakpointhook. The normal hook uses pdb, so an interactive terminal is usually needed; a configured hook may instead do something else. Arguments are forwarded to that hook. PYTHONBREAKPOINT affects the default hook, not every custom hook. A missing hook raises RuntimeError. Avoid leaving interactive breakpoints in automated jobs.
Formal Syntax & Structure
python syntaxpython
breakpoint(*args, **kws)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| args | object | Positional arguments accepted by the selected hook. |
| kws | object | Keyword arguments accepted by the selected hook. |
Return Value
hook-dependent result
Returns whatever the hook returns; the ordinary debugger hook returns None.
Working Example
Example Snippetpython
# Local demonstration: replace the hook temporarily to avoid pausing.import sysoriginal = sys.breakpointhooktry: sys.breakpointhook = lambda label: print("checkpoint:", label) breakpoint("validation")finally: sys.breakpointhook = original