Top-rated recipes tagged "builtins"http://code.activestate.com/recipes/tags/builtins/top/2015-10-16T12:11:58-07:00ActiveState Code RecipesAdd function to Python's __builtin__ module through C API (C)
2015-10-16T12:11:58-07:00airweenhttp://code.activestate.com/recipes/users/4192997/http://code.activestate.com/recipes/579110-add-function-to-pythons-__builtin__-module-through/
<p style="color: grey">
C
recipe 579110
by <a href="/recipes/users/4192997/">airween</a>
(<a href="/recipes/tags/api/">api</a>, <a href="/recipes/tags/builtins/">builtins</a>, <a href="/recipes/tags/c/">c</a>, <a href="/recipes/tags/exten/">exten</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>Add function to __builtin__ module through C API</p>
<p>Sometimes it need to embedding a Python script to a C code, and it references to a function, which also provided by the same C code. Then you have to import the module, as you defined in your C code.</p>
<p>But this import would be skipped, if you add your function to your __builtin__ module. In Python3 (3.5), there is the PyModule_AddFunctions() function, but in the previous versions, you can make it like this snippet.</p>
<p>See these recipes:</p>
<p>Makefile:
<a href="https://code.activestate.com/recipes/579111-add-function-to-__builtin__-module-through-c-api-c/" rel="nofollow">https://code.activestate.com/recipes/579111-add-function-to-__builtin__-module-through-c-api-c/</a></p>
<p>Python script:
<a href="https://code.activestate.com/recipes/579112-add-function-to-__builtin__-module-through-c-api-c/" rel="nofollow">https://code.activestate.com/recipes/579112-add-function-to-__builtin__-module-through-c-api-c/</a></p>
See What the Builtins Are (Python)
2011-11-04T22:44:09-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577888-see-what-the-builtins-are/
<p style="color: grey">
Python
recipe 577888
by <a href="/recipes/users/4177816/">Eric Snow</a>
(<a href="/recipes/tags/builtins/">builtins</a>).
Revision 3.
</p>
<p>The built-ins are all those functions, constants, and types that are there when you need them most, like <code>list</code>, <code>any</code>, and <code>None</code>. This recipe is a simple way of looking at the built-ins. Check below for a thorough explanation.</p>