Popular recipes tagged "inspection" but not "source"http://code.activestate.com/recipes/tags/inspection-source/2011-09-29T20:07:10-07:00ActiveState Code RecipesInspect a PYC File (Python)
2011-09-29T20:07:10-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577880-inspect-a-pyc-file/
<p style="color: grey">
Python
recipe 577880
by <a href="/recipes/users/4177816/">Eric Snow</a>
(<a href="/recipes/tags/bytecode/">bytecode</a>, <a href="/recipes/tags/inspection/">inspection</a>, <a href="/recipes/tags/pyc/">pyc</a>).
Revision 3.
</p>
<p>This is a revamp of a recipe that Ned Batchelder <a href="http://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html">posted on his blog</a> a few years ago (thanks Ned!). That page is pretty insightful, recipe aside.</p>
<p>This recipe works for all versions of Python back to 2.4 (at least). Warning: using one version of Python to inspect a pyc file from another Python version may not work too well.</p>
Trace decorator for debugging (Python)
2011-01-24T18:40:51-08:00Kevin L. Sitzehttp://code.activestate.com/recipes/users/4173535/http://code.activestate.com/recipes/577551-trace-decorator-for-debugging/
<p style="color: grey">
Python
recipe 577551
by <a href="/recipes/users/4173535/">Kevin L. Sitze</a>
(<a href="/recipes/tags/classes/">classes</a>, <a href="/recipes/tags/debug/">debug</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/decorators/">decorators</a>, <a href="/recipes/tags/functions/">functions</a>, <a href="/recipes/tags/inspection/">inspection</a>, <a href="/recipes/tags/modules/">modules</a>, <a href="/recipes/tags/trace/">trace</a>).
Revision 2.
</p>
<p>This package provides a decorator for tracing function and method calls in your applications. The tracing capabilities are managed through the logging package, and several mechanisms are provided for controlling the destination of the trace output.</p>
<p>It also provides functionality for adding decorators to existing classes or modules.</p>
print variables as a dictionarly (Python)
2009-03-27T07:39:13-07:00Maxim Khesinhttp://code.activestate.com/recipes/users/2591465/http://code.activestate.com/recipes/576700-print-variables-as-a-dictionarly/
<p style="color: grey">
Python
recipe 576700
by <a href="/recipes/users/2591465/">Maxim Khesin</a>
(<a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/inspection/">inspection</a>, <a href="/recipes/tags/print/">print</a>).
Revision 2.
</p>
<p>Often I need to print some diagnostic variables and have to construct a format string to include both name and value; but there is a quicker way! This is especially useful for tracing function call values (foo in example below)</p>