Live data from Hacker News

PySnooper: Never use print for debugging again

github.com

81–90 of 175 posts

Re: PySnooper: Never use print for debugging again

#81
post #61

Earlier quoted context omitted.

But this isn't a debugger. It's just instrumenting a function with some very verbose logs.

But it's harder to install this, import it, and add a decorator than it is to type "breakpoint()".

That requires an interactive session, for example starting the program yourself from the command line.

Re: PySnooper: Never use print for debugging again

#82
post #71
post #33

Earlier quoted context omitted.

In practical terms, what would that achieve?

Professionalism.

"Any time somebody tells you that you shouldn’t do something because it’s “unprofessional,” you know that they’ve run out of real arguments." -- Joel Spolsky

Re: PySnooper: Never use print for debugging again

#83
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 supports the equivalent of print statements, e.g. set print breakpoint on a variable to print its value every time it’s run, instead of typing print everywhere.

Re: PySnooper: Never use print for debugging again

#84

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…

Yeah. Python is dead easy to debug via pdb.

If you don’t want to go CLI-debugging both VSCode and Emacs have more integrated, in-editor options.

Many bugs can be isolated and reproduced in unit-tests. That’s just a click away from being debuggable inside a real debugger. Why use anything but that?

To me, not using a debugger to debug seems kinda crazy.

Re: PySnooper: Never use print for debugging again

#85
> You'd love to use a full-fledged debugger with breakpoints and watches, but you can't be bothered to set one up right now.

In VSCode: built in. Press the play icon.

In Emacs: M-x realgud:pdb

Is that really more effort than this?

Why invent inferior solutions to solved problems?

Re: PySnooper: Never use print for debugging again

#86
post #71

Earlier quoted context omitted.

Professionalism.

"Any time somebody tells you that you shouldn’t do something because it’s “unprofessional,” you know that they’ve run out of real arguments." -- Joel Spolsky

Or there is a whole suite of behavior and conduct with well thought out reasons that have been comprehensively debated over the years that have been put under the rubric of professionalism and there is zero reason to rehash the same arguments over and over and over ad infinitum.

Re: PySnooper: Never use print for debugging again

#87
post #78
post #71

Earlier quoted context omitted.

Professionalism.

One-word quips sound good on paper, but this is an open source project with engineers as the target audience. It's not seeking (at this time) to bring revenue or make sales, so I'd argue that speaking truth to the problem is more likely to drive up adoption.

Citing professionalism isn't a quip, it's shorthand for a code of conduct and long accepted practices of interaction with others.

May I ask how the word "shitty" more truthful than "poorly written" or "complex"?

Re: PySnooper: Never use print for debugging again

#88

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…

I love using PDB, but even still this has a different use case. Say you have a bug in a function and it depends on timing or it's a race condition, or it has a lot of statements. Being able to see the state throughout the function in your output may be able to catch things or speed up debugging.

Re: PySnooper: Never use print for debugging again

#89
post #87
post #78

Earlier quoted context omitted.

One-word quips sound good on paper, but this is an open source project with engineers as the target audience. It's not seeking (at this time) to bring revenue or make sales, so I'd argue that speaking truth to the problem is more likely to drive up adoption.

Citing professionalism isn't a quip, it's shorthand for a code of conduct and long accepted practices of interaction with others. May I ask how the word "shitty" more truthful than "poorly written" or "complex"?

> May I ask how the word "shitty" more truthful than "poorly written" or "complex"?

Evokes emotions people affected by a situation can sympathize with more effectively, which by virtue of establishing a shared emotional bond over a topic helps the developer convey not just the situation but the frustrations of the situation more effectively than one might expect "poorly written" or "complex" to do alone.

> Citing professionalism isn't a quip, it's shorthand for a code of conduct and long accepted practices of interaction with others.

The code of conduct isn't uniform, so it can't be used effectively as shorthand for such. But at this point we're in the weeds.

Again, no short-term revenue prospects, just a tool OP wants to socialize to make a few lives easier. If you have an objection over verbiage, that's fine, but it's an exhibition of professionalism from yourself to the OP to build a sound defense of your position as to how it would help the engineer to self-censor the description of a tool where the audience by-and-large may not care.

Up to you. My point is the engineer doesn't need to suppress who they are in this specific context, and my point to you is it shouldn't impact your usage of what looks to be an effective short-term debugging tool.

Post reply on HN