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

Software Engineer for AI Training Data (School Specific)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Python)

@ G2i Inc | Remote

Software Engineer for AI Training Data (Tier 2)

@ G2i Inc | Remote

Data Engineer

@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania

Artificial Intelligence – Bioinformatic Expert

@ University of Texas Medical Branch | Galveston, TX

Lead Developer (AI)

@ Cere Network | San Francisco, US