breakpoint() Enter debugger
Last updated: 2026-09-22
breakpoint() Enter debugger
breakpoint() drops into the debugger (pdb by default); customizable via PYTHONBREAKPOINT or sys.breakpointhook().
| Category | Built-in Functions |
|---|---|
| Kind | Built-in Function |
| Python Version | 3.7+ |
📝 Syntax
breakpoint(*args, **kws)
⚙️ Parameters
| args Optional | Variable positional arguments passed through to the hook. |
|---|---|
| kwargs Optional | Variable keyword arguments passed through to the hook. |
Returns:None; the actual behavior is delegated to sys.breakpointhook().
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
breakpoint skipped
after
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QHow do I keep breakpoint() from activating in production?
ASet the environment variable PYTHONBREAKPOINT=0, or run sys.breakpointhook = lambda *a, **k: None in your code; after that breakpoint() becomes a no-op.
QWhat debugger does breakpoint() enter by default?
AIt enters pdb (Python's built-in debugger). The program pauses at the call site and shows a (Pdb) prompt where you can inspect/modify variables and step through the code.
QWhat is the difference between debugging with breakpoint() vs print()?
Aprint() can only print output and you have to insert/remove it manually; breakpoint() drops you into a real debugger where you can inspect all local variables, evaluate arbitrary expressions, and step through — then delete one line when done.
QCan I customize the breakpoint behavior?
AYes. Point sys.breakpointhook at a custom hook (e.g. ipdb.set_trace), or specify one via the PYTHONBREAKPOINT environment variable, for instance to use an alternative to pdb.