7 Respostas
+ 4
https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-debugging-pdb/
I usually just use VSCode debugger feature instead of pdb, it is really easy to visually set breakpoints, and check the variables in memory while stepping through the code, or occasionally evaluating an expression in the command line.
Another alternative is using Python shell REPL to try things interactively, or even use IDLE, the built in editor that comes bundled with CPython.
https://realpython.com/python-repl/
https://realpython.com/python-idle/
+ 3
Debugging is not meant to make your code bigger. Its purpose is for you to find and fix errors easier. "Heavy" is not really a good word.
You can also use other ways to ensure your code is correct, particularly writing unit tests. This doesnot replace the process of debugging, but complements it.
+ 3
ayrad izem
you don't need to import pdb at the top of your code.
just add
breakpoint()
in the part of the code you want to inspect. This does the same thing as
import pdb;pdb.set_trace()
it is easier to remove or comment out if you no longer need it.
https://www.geeksforgeeks.org/debugging-JUMP_LINK__&&__python__&&__JUMP_LINK-code-using-breakpoint-and-pdb/
+ 1
Bob_Li thank you
0
@Tibor Santa thank you
If I use module bdp it means I will use more code and the program will be more heavy ??
0
Tibor Santa I means when I import module pdb into my code , then my code will be more complexe than if I will use debugging built in my Pycharm for exemple ?