Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python.announce > #1987 > unrolled thread

PyEmbedC 1.0 - Embed C in Python code

Started byFen Trias <sub@trias.org>
First post2016-01-16 18:53 -0500
Last post2016-01-16 18:53 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python.announce


Contents

  PyEmbedC 1.0 - Embed C in Python code Fen Trias <sub@trias.org> - 2016-01-16 18:53 -0500

#1987 — PyEmbedC 1.0 - Embed C in Python code

FromFen Trias <sub@trias.org>
Date2016-01-16 18:53 -0500
SubjectPyEmbedC 1.0 - Embed C in Python code
Message-ID<mailman.63.1453039875.15297.python-announce-list@python.org>
Python module for embedding C/C++ code within Python code. It is
designed to allow coders to easily speed up slow code by replacing small
portions of Python with compiled C/C++ that can transparently read
and modify Python variables. Keeping all the code in the same source
file simplifies development and improves code readability. All the
compiling and linking is done dynamically by the module to further
simplify development.

* Embed C/C++ within Python source code
* Automatically compile and dynamically link using GCC
* Access and modify Python variables as C variables
* Support arrays and strings
* Use ctypes for maximum portability

Simple Example:

from embedc import C
a=[1,4,9]
alen=len(a)
C("""
  for (int i=0; i<alen; i++) {
    a[i] = a[i]*a[i];
  }
""")
print a

Output: [1,16,81]

<P><A HREF="http://pyembedc.sourceforge.net/">PyEmbedC 1.0</A> -
Module to embed C/C++ code within Python code and read/modify
variables natively. (16-Jan-2016)<P>

[toc] | [standalone]


Back to top | Article view | comp.lang.python.announce


csiph-web