Writing Extensions for Python 3 in C

rusi rustompmody at gmail.com
Wed Jun 19 13:11:30 EDT 2013


On Jun 18, 3:24 pm, Aditya Avinash <adityaavinash... at gmail.com> wrote:
> Hi. This is the last place where I want to ask a question. I have searched
> for lots of tutorials and documentation on the web but, didn't find a
> decent one to develop extensions for Python 3 using a custom compiler
> (mingw32, nvcc). Please help me.
> PS: Don't point me to Python Documentation. It is not good for beginners.
> It doesn't elaborate about calls and implementation.

You need to tell what youve read, what youve tried, where stuck.
Yes the extending and embedding stuff http://docs.python.org/2/extending/
and
http://docs.python.org/2/c-api/index.html is more difficult than much
other than other python docs.

That is intrinsic to the problem -- you are not in the python world
but the C world and C is a much harder and headachey-er than python.
And building the python infrastructure on top of that is still harder.

If you have to use it, you really need to get the data-structure
invariants right: eg http://docs.python.org/2/c-api/intro.html#objects-types-and-reference-counts.

However as Terry suggests, using something like Cython to avoid this
should always be first explored.  Heres a list

1. 'Classic' extending/embedding
2. SCXX
3. PyCXX
4. Boost
5. Ctypes
6. Swig
7. Sip
8. cython

Explore in reverse order!



More information about the Python-list mailing list