PySnooper: Never use print for debugging again

PySnooper: Never use print for debugging again

Most people would use lines, in strategic locations, some of them showing the values of variables. You’ll get a play-by-play log of your function, including which lines ran and when, and exactly when local variables were changed. Let’s snoop on it by adding the decorator:

The output to stderr is:

If stderr is not easily accessible for you, you can redirect the output to a file:

See values of some variables that aren’t local variables:

Show snoop lines for functions that your function calls:

Start all snoop lines with a prefix, to grep for them easily:

Copyright (c) 2019 Ram Rachum, released under the MIT license.

Source: github.com