this post was submitted on 30 Sep 2023
317 points (91.6% liked)

Programmer Humor

32472 readers
866 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] jjjalljs@ttrpg.network 4 points 1 year ago

I don't know how to use vscode. In general in Python you can do breakpoint() and your code will pause there and become interactive. If you're running in docker you'll want to attach to the container. When it hits the breakpoint you basically drop into a normal python repl with extra features.

https://docs.python.org/3/library/pdb.html

This is really, really, good for debugging and developing. You can interactively examine stuff and try stuff right there. You don't have to rerun the whole thing to be like "ok what's the second item in the list? Is this syntax right to sort it?" or whatever you're trying to do

I use pdb++ for syntax highlighting and some other qol features, too.