achieving performance using C/C++

Filip Wasilewski filipwasilewski at gmail.com
Mon Nov 5 06:51:32 EST 2007


On Nov 5, 7:40 am, sandipm <sandip.m... at gmail.com> wrote:
> I did fair amount of programming in python but never used c/c++ as
> mentioned below.
> any good tutorials for using C/C++ to optimize python codebase for
> performance?
> how widely do they use such kind of mixed coding practices?
[...]

Since you are fluent in Python I also suggest you to start with
Pyrex[1]/Cython[2]. This will let you to express your ideas more
naturally (in a Python-based language) and interface with C code base
without delving much into reference counting, manual parameters
conversion and low-level exception handling.

You will find some tutorials and links to resources and mailing lists
on the projects websites, and if you specify your problem a bit more
then probably someone will be able to give you more precise
references.

For alternatives take a look at [3] and [4]. Try also scanning the
Python Package Index[5] for 'binding', 'wrapper', 'lib' or 'pyrex'
keywords or browse for C/C++ Programming Language category as this
will return some examples of Python extensions.

[1] http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
[2] http://www.cython.org/
[3] http://www.python.org/doc/faq/extending/#writing-c-is-hard-are-there-any-alternatives
[4] http://docs.python.org/lib/module-ctypes.html
[5] http://pypi.python.org

fw




More information about the Python-list mailing list