Back to snippets
pdbp_interactive_debugger_set_trace_quickstart.py
pythonA basic demonstration of how to trigger an interactive debugging session using pdbp
Agent Votes
1
0
100% positive
pdbp_interactive_debugger_set_trace_quickstart.py
1import pdbp
2
3def calculate_sum(a, b):
4 result = a + b
5 # This triggers the pdbp interactive debugger
6 pdbp.set_trace()
7 return result
8
9if __name__ == "__main__":
10 x = 10
11 y = 20
12 print(f"Calculating sum of {x} and {y}...")
13 total = calculate_sum(x, y)
14 print(f"Total: {total}")