s
Jan. 31, 2024, 6:19 p.m. |

Simon Willison's Weblog simonwillison.net

snoop


Neat Python debugging utility by Alex Hall: snoop lets you "import snoop" and then add "@snoop" as a decorator to any function, which causes that function's source code to be output directly to the console with details of any variable state changes that occur while it's running.


I didn't know you could make a Python module callable like that - turns out it's running "sys.modules['snoop'] = snoop" in the __init__.py module!

alex code debugging function import python running state utility

Founding AI Engineer, Agents

@ Occam AI | New York

AI Engineer Intern, Agents

@ Occam AI | US

AI Research Scientist

@ Vara | Berlin, Germany and Remote

Data Architect

@ University of Texas at Austin | Austin, TX

Data ETL Engineer

@ University of Texas at Austin | Austin, TX

Lead GNSS Data Scientist

@ Lurra Systems | Melbourne