I was hooked for 2 minutes with the Python debugger pdb

Get hooked on pdb for 2 minutes

Are you using pdb? There are many good IDEs such as Pycharm, and there are various useful debugging modules, but I'm developing and debugging exclusively with vim and pdb.

If the scope is reasonably wide, single-letter variables are not very good, If you only have a few lines, you might store the return of requests in the variable name r (I often do).

I happened to want to debug around r = request.post (hogehoge) I was using pdb, but when I press r, it jumps to the function return for some reason.

Repeat it several times.

Yes. As you can see, pressing r on the pdb just runs the function to the end. I'm ashamed to say that I didn't know until now. ..

doc https://docs.python.org/3.6/library/pdb.html#pdbcommand-return

Conclusion

Read the documentation properly. There are various commands in pdb, which is convenient.

Recommended Posts

I was hooked for 2 minutes with the Python debugger pdb
I liked the tweet with python. ..
I tried to refer to the fun rock-paper-scissors poi for beginners with Python
[Python] I was hooked for an hour trying to use list comprehensions
I measured the speed of list comprehension, for and while with python2.7.
[Python] I tried substituting the function name for the function name
vprof --I tried using the profiler for Python
I tried "differentiating" the image with Python + OpenCV
Play with Lambda layer (python) for about 5 minutes
Use logger with Python for the time being
I played with Floydhub for the time being
I tried python programming for the first time.
[Python] I searched for the longest Pokemon Shiritori
I tried "binarizing" the image with Python + OpenCV
Two things I was happy about with Python 3.9
I tried searching for files under the folder with Python by file name
What I got into Python for the first time
I tried Python on Mac for the first time.
Run with CentOS7 + Apache2.4 + Python3.6 for the time being
I tried to touch the CSV file with Python
I tried to solve the soma cube with python
I tried python on heroku for the first time
I was addicted to scraping with Selenium (+ Python) in 2020
I want to inherit to the back with python dataclass
Information for controlling the motor with Python on RaspberryPi
A memo that I touched the Datastore with python
I tried to solve the problem with Python Vol.1
I moved the automatic summarization API "summpy" with python3.
I tried hitting the API with echonest's python client
I tried to find the entropy of the image with python
I tried fp-growth with python
I tried scraping with Python
I replaced the Windows PowerShell cookbook with a python script.
I tried "gamma correction" of the image with Python + OpenCV
I tried to simulate how the infection spreads with Python
I wrote the code for Japanese sentence generation with DeZero
I tried using the Python library from Ruby with PyCall
I wanted to solve the Panasonic Programming Contest 2020 with Python
Why can I use the module by importing with python?
I touched the latest automatic test tool "Playwright for Python"
Insert the debugger with nose
Debugging with pdb in Python
I made blackjack with python!
I wrote the basic grammar of Python with Jupyter Lab
I evaluated the strategy of stock system trading with Python.
What I did to welcome the Python2 EOL with confidence
[Python] I want to use the -h option with argparse
Create a Twitter BOT with the GoogleAppEngine SDK for Python
I didn't know how to use the [python] for statement
I just wrote the original material for the python sample code
Miscellaneous notes that I tried using python for the matter
Call the API with python3.
I tried gRPC with Python
I tried scraping with python
I made blackjack with Python.
I tried to divide the file into folders with Python
I made wordcloud with Python.
I downloaded the python source
Life game with Python [I made it] (on the terminal & Tkinter)
I tried scraping the ranking of Qiita Advent Calendar with Python
I tried to solve the ant book beginner's edition with python