James Kingston Clarke

TIL About Python breakpoints

breakpoint() can be used to break into an interactive pdb session

def double(x):
   breakpoint()
   return x * 2
val = 3
print(f"{val} * 2 is {double(val)}")
> ...(2)double()
-> breakpoint()
(Pdb) p x
3
(Pdb) continue
3 * 2 is 6

References