Can't understand python C apis

Dieter Maurer dieter at handshake.de
Sat Jun 23 05:14:35 EDT 2012


gmspro <gmspro at yahoo.com> writes:
>  I'm trying to understand the source code of python and how it works internally.                                                                  
>  But i can't understand the python C apis.

Usually, you try to understand the Python C api in order to write
extensions for Python in C (e.g. to interface with an existing C library
or to optimize a tight loop).

If this is the case for you, then there is an alternative: "Cython".
"Cython" actually is a compiler which compiles an extended Python
source language (Python + type/variable declarations + extension types)
into "C". With its help, you can create C extensions for Python
without a need to know all the details of the Python C API.

It might still be necessary at some point to understand more
of the API but highly likely it will take considerable time
to reach that point -- and then you might already be more familiar
and the understanding might be easier.




More information about the Python-list mailing list