Live data from Hacker News

PySnooper: Never use print for debugging again

github.com

171–175 of 175 posts

Re: PySnooper: Never use print for debugging again

#172

For my Django projects the development server is werkzeug [1] and anywhere a break point is needed I'll add 1/0 in the code then hit refresh in the browser which pulls up an interactive debugger [2]. [1] https://django-extensions.readthedocs.io/en/latest/runserver... [2] https://werkzeug.palletsprojects.com/en/0.15.x/debug/#using-...

FYI you can do import pdb; pdb.set_trace() It pulls up console debugger and is a standard python package.

With python 3.7 you can just do 'breakpoint()' now, and it'll import pdb and run settrace. It also allows you to use other debuggers, pretty cool.

Re: PySnooper: Never use print for debugging again

#173

For my Django projects the development server is werkzeug [1] and anywhere a break point is needed I'll add 1/0 in the code then hit refresh in the browser which pulls up an interactive debugger [2]. [1] https://django-extensions.readthedocs.io/en/latest/runserver... [2] https://werkzeug.palletsprojects.com/en/0.15.x/debug/#using-...

Lol this is pretty funny. I like your style.

Re: PySnooper: Never use print for debugging again

#174
post #34

Again, Ram - it's a really nice project. Good luck with it. But just in case if you from print cult, you will like https://github.com/gruns/icecream

I looked at icecream and I really like pysnooper more. Especially for big complicated programs.

Re: PySnooper: Never use print for debugging again

#175

This is a thoughtful hack but the real solution here is a) make debuggers easier to set up and b) make your project easily debuggable with a debugger from the beginning. Like, debugging should be considered part of programming, and a local dev environment that can’t be debugged should be viewed to be as broken as a codebase without e.g. a way to run the server in watch mode. Also someone should make a debugger that s…

True...but inheriting code, not having time to refactor, and just getting a basic version out the door...pysnooper is pretty useful.
Post reply on HN