Define a constant in Python C extension

Stefan Behnel stefan_ml at behnel.de
Sat Feb 28 01:38:41 EST 2009


fredbasset1000 at gmail.com wrote:
> I'm writing a C extension for Python, is it possible to define
> constants in the C code and have them visible from Python?

Have you looked at Cython? It allows you to define e.g. enums as "public"
and will generate the rest for you.

http://cython.org

Stefan



More information about the Python-list mailing list