[python-ldap] One vote for 3.x

Christian Heimes lists at cheimes.de
Thu Dec 1 01:13:45 CET 2011


Am 29.11.2011 14:42, schrieb Chris Dukes:
> My two cents for anyone wanting to start on it.
> 1) Start by either getting _ldap.so to work with python 3.x, *OR*
> replace _ldap.so with pure python calling 'ctypes' that maintains close
> to the same interface.  The latter will probably be quicker to develop.
> The former will work on less loved OSes like AIX.

*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.

Cython is used in several major projects, e.g. NumPy. lxml is written
entirely in Python and Cython.

Christian

[1] http://cython.org/



More information about the python-ldap mailing list