Live data from Hacker News

Show HN: Python decorator to log local variables with each line of code run

pypi.org

1–10 of 14 posts

Re: Show HN: Python decorator to log local variables with each line of code run

#4
post #2

WIP: suggestions most welcome.

How does it compare to snoop: https://news.ycombinator.com/item?id=20457784

Ahh, I never heard about it, but it looks promising.

I will reach out to the author.

Thanks for bringing it to my attention.

Re: Show HN: Python decorator to log local variables with each line of code run

#6
post #4

Earlier quoted context omitted.

How does it compare to snoop: https://news.ycombinator.com/item?id=20457784

Ahh, I never heard about it, but it looks promising. I will reach out to the author. Thanks for bringing it to my attention.

For PyTorch, there’s a TorchSnooper. In production, I’ve added both snoop and torchsnooper to flake8 banned modules.

Re: Show HN: Python decorator to log local variables with each line of code run

#8
post #7

What advantage does this have over a debugger? (To be fair, in my experience, lots of python users have no idea what a debugger is...)

same thoughts. i kind of get the utility of logging the whole application state without breakpoints or stepping through stuff (but maybe debuggers can also do this?), but my first thought was that this is simpler for folks not used to debuggers

Re: Show HN: Python decorator to log local variables with each line of code run

#10
post #7

What advantage does this have over a debugger? (To be fair, in my experience, lots of python users have no idea what a debugger is...)

same thoughts. i kind of get the utility of logging the whole application state without breakpoints or stepping through stuff (but maybe debuggers can also do this?), but my first thought was that this is simpler for folks not used to debuggers

It is not unusual for me to have a for-loop running for a few hours as it is processing thousands of small objects or just a few dozen of large ones. A debugger wouldn't necessarily help me in this case and this decorator would be a little easier to set up than a logger.
Post reply on HN