Re:Guide to Python Debugging
by drpancake on Tuesday June 02, 2020 @03:22AM
(#23388544)
I've been a Python developer for more than ten years. Approximately 98% of the time I need to debug something I use print() statements and this:
[ Parent
| on HN ]
Re:Guide to Python Debugging
by quickthrower2 on Tuesday June 02, 2020 @04:38AM
(#23388980)
I've been a Python developer for less than 10 hours. Approximately 98% of the time debugged something was in Visual Studio. Quite a nice experience. I was lucky to have the project already set up for me.
Re:Guide to Python Debugging
by justmyname on Tuesday June 02, 2020 @03:37AM
(#23388628)
Oh, having full ipython during debug investigations is much better than using pure pdb.set_trace(). Thank you.
You might find this useful: https://github.com/gotcha/ipdb
Re:Guide to Python Debugging
by musingsole on Tuesday June 02, 2020 @12:43PM
(#23393028)
This has been my go-to debug method for years now. Find a critical section of code, drop the embed call there (with maybe a print statement or two leading up to it for context).
For stepping through code, I agree with your other comments that it is often too much for debugging. To recreate it when really necessary, I might sprinkle a handful of embed calls
Are you aware of this:
import pudb; pudb.set_trace()Yes. My point is that I find stepping through code (e.g. using pdb) to be overkill in most cases.
Or
import pudb; pu.db
for the impatient typist.Can you step through the code when embedding ipython in your code? Does this approach have advantages versus `ipdb` or `pdb++` ?
No, but I rarely find it helpful to step through code. That's the other 2%.
import ipdb; ipdb.set_trace()
IPython pdb session.