difference between ipdb and pdb++?
Asked Answered
E

1

13

Python has its default debugger called pdb, but there are a few alternatives created by the community. Two of them are ipdb and pdb++. They seem to cater to the same audience, they can both be run directly at the CLI and provide some niceties such as colored output and tab-completion.

Do they serve different purposes or are they simply competing debuggers with similar features? I'm having trouble understanding when one would wish to use one over the other. There seem to even be people using both at the same time

Encourage answered 9/5, 2021 at 2:5 Comment(1)
Related: #65816773Gamophyllous
T
10

I'm not a pdbpp expert, but to me ipdb comes with more features (IPython has many "magic" functions such as %timeit, %debug, etc that are handy), while pdbpp has a sticky mode that displays the source in the terminal as you step through (like GDB's TUI mode) and is more capable than the default pdb.

So they are both good options to debug, but my personal preference goes to ipdb because I'm used to work interactively from IPython. I've found I could set my main debugger to ipdb like so:

export PYTHONBREAKPOINT=ipdb.set_trace   # or ipdb.sset_trace

And put breakpoint() in the Python source to debug. If pdbpp is also installed, I can invoke sticky from the ipdb session, which is neat.

Tenotomy answered 25/4, 2022 at 15:30 Comment(1)
What about alternatives such as sentry and debugpy?Unilocular

© 2022 - 2024 — McMap. All rights reserved.