The breakpoint() function,pauses the program execution and enters the interactive debugger, Pdb.

It can be used to inspect the program state,  to modify values, change the program flow then continue the execution.

The breakpoint() function takes no arguments and does not return any value.

ExampleEdit & Run
breakpoint()
copy
Output:
--Return-- > <string>(6)<module>()->None (Pdb)  Traceback (most recent call last):   File "/app/.heroku/python/lib/python3.11/bdb.py", line 94, in trace_dispatch     return self.dispatch_return(frame, arg)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   File "/app/.heroku/python/lib/python3.11/bdb.py", line 156, in dispatch_return     if self.quitting: raise BdbQuit                       ^^^^^^^^^^^^^ bdb.BdbQuit [Finished in 0.03841446107253432s]

PDB stands for the Python Debugger , it is defined in the pdb module in the standard library. The debugger provides an interactive prompt for the user to inspect and debug their code. It allows users to step through code line by line, set breakpoints, view or change variables, evaluate expressions, then continue with the execution.

The continue statement is used to leave the debugger and continue with the execution.

ExampleEdit & Run
def calculate_sum(x, y):
    breakpoint()
    result = x + y
    return result

sum_total = calculate_sum(2, 3)
copy