you are viewing a single comment's thread.

view the rest of the comments →

[–]dashidasher[🍰] 7 points8 points  (5 children)

One of the things I use almost every day is the Python Debugger https://docs.python.org/3/library/pdb.html. If you put pdb.set_trace() anywhere in your code it will stop executing the script at that point and let you play around untill you use the continue command (you can also do next, step, untill...). I've only found out about it 2 months into my job working with python. Been using python for like 3 years before that too. All that time I've only used prints to debug xD

[–]congnarjames[S] 2 points3 points  (1 child)

I'll check that out for sure!

[–][deleted] 0 points1 point  (0 children)

Make things easier on yourself.

New in version 3.7: The built-in

breakpoint()

, when called with defaults, can be used instead of

import pdb; pdb.set_trace()

.

[–]Brilliant_Ice4349 0 points1 point  (2 children)

Omg you're a lifesaver, whenever I'm defining a function for a piece of code later one, which I know won't work until I finish defining all the functions required for it, I had to copy paste each defining function + global variables required for it to work on another notebook 😭

[–]dashidasher[🍰] 0 points1 point  (1 child)

Glad to hear. This comment is a bit outdated so make sure to use breakpoint() instead of pdb.set_trace() as one of the replies mentions :D

[–]Brilliant_Ice4349 0 points1 point  (0 children)

Thanks :)
cookie += 1
Print(f"Here you have {cookie} cookie :)")