Popular recipes tagged "compiler"http://code.activestate.com/recipes/tags/compiler/2015-01-29T20:54:38-08:00ActiveState Code RecipesBuild extension modules inplace with a Makefile (Python)
2015-01-29T20:54:38-08:00Zack Weinberghttp://code.activestate.com/recipes/users/4190298/http://code.activestate.com/recipes/579016-build-extension-modules-inplace-with-a-makefile/
<p style="color: grey">
Python
recipe 579016
by <a href="/recipes/users/4190298/">Zack Weinberg</a>
(<a href="/recipes/tags/compiler/">compiler</a>, <a href="/recipes/tags/module/">module</a>).
</p>
<p>Do you find distutils to be poorly documented, overdesigned yet still inadequate, and far too difficult to do anything out of the ordinary with? Do you find yourself wishing that you could just write a Makefile for your extension modules, if only you knew how to form the compile commands?</p>
<p>Then this tool is for you. An example (GNU) makefile to use it with is embedded in the code; it assumes you save this program as <code>get-module-compile-cmds.py</code> in the same directory as the makefile. Tested with 2.7 and 3.4; may work with older versions as well.</p>
<p>Installation is not currently supported; patches welcome.</p>
Nested contexts -- a chain of mapping objects (Python)
2010-10-25T02:13:37-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/577434-nested-contexts-a-chain-of-mapping-objects/
<p style="color: grey">
Python
recipe 577434
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/ast/">ast</a>, <a href="/recipes/tags/chained/">chained</a>, <a href="/recipes/tags/compiler/">compiler</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/inheritance/">inheritance</a>, <a href="/recipes/tags/nested/">nested</a>, <a href="/recipes/tags/nonlocal/">nonlocal</a>, <a href="/recipes/tags/scopes/">scopes</a>, <a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>Easy to use chain of dictionaries for crafting nested scopes or for a tree of scopes. Useful for analyzing AST nodes, XML nodes or other structures with multiple scopes. Can emulate various chaining styles including static/lexical scoping, dynamic scoping and Python's own globals(), locals(), nested scopes, and writeable nonlocals. Can also model Python's inheritance chains: instance dictionary, class dictionary, and base classes.</p>