[python-ldap] One vote for 3.x

Tim Golden mail at timgolden.me.uk
Thu Dec 1 10:14:07 CET 2011


On 01/12/2011 08:50, Michael Ströder wrote:
> Christian Heimes wrote:
>> *OR* use Cython [1] to interface with libldap. I've tried both ctypes
>> and Cython in the past. Nowadays I use Cython exclusively to optimized
>> code and interfacing with C/C++ libraries. Cython is a great tool
>> because it takes care of all the boiler plate stuff you don't want to
>> write manually. Cython looks like Python code with some C annotations.
>> Anybody with basic knowledge of C and Python can understand and modify
>> the code -- you don't need to know the Python C API. Carefully written
>> Cython code compiles to C extensions for every major version of CPython
>> from 2.4 to 3.2 without additional work.
 >
> But don't you then need Cython installed to build a certain module?

Cython (essentially) converts Python to the equivalent C.
So you can either ship the original source and require Cython
to be available at build time. Or you can ship the results
of the Cython "preprocess" which are just .c files. This
is covered (in brief) here:

http://docs.cython.org/src/quickstart/build.html

>
> And how about pre-compiled binaries? Do they need extra Cython parts shipped
> along with them?

Same again: Cython converts Python to C so there's no extra Cython
parts needed; it just saves you from writing out the extension
modules longhand. (Obviously I'm simplifying things here
but that's the effect).

The main Cython developer (Stefan Behnel) is always keen for people
to use Cython; I'm sure he'd be happy to advise.

TJG


More information about the python-ldap mailing list