MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/pythontips/comments/mc4vfm/how_to_debug_in_python/gsaofvg/?context=3
r/pythontips • u/[deleted] • Mar 24 '21
Please share some tips about the title.
38 comments sorted by
View all comments
6
Really surprised no one mentioned:
import pdb
pdb.set_trace()
I put that anywhere I want to inspect what is going on and run the script! Then you can see what variables are at that point and also go through the code line by line!
1 u/zaxswyre Mar 26 '21 New in version 3.7: The built-inbreakpoint(), when called with defaults, can be used instead ofimport pdb; pdb.set_trace().
1
New in version 3.7: The built-in
breakpoint()
, when called with defaults, can be used instead of
import pdb; pdb.set_trace()
.
6
u/miamiredo Mar 25 '21
Really surprised no one mentioned:
import pdbpdb.set_trace()I put that anywhere I want to inspect what is going on and run the script! Then you can see what variables are at that point and also go through the code line by line!