Python breakpoint() built-in function

From the Python 3 documentation

This function drops you into the debugger at the call site [...].
Python breakpoint() calls Python debugger at a given line

Example

>>> # Create a loop over 5 integers
>>> for i in range(5):
...     # Stream i to stdout
...     print(i)
...    # Create breakpoint at # 3
...    if i == 3:
...        breakpoint()
...
# 0
# 1
# 2
# 3
# > c:\users\user\path\to\your\project\example.py(24)<module>()
# -> for i in range(5):
# (Pdb)

Subscribe to pythoncheatsheet.org

Join 8.800+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.