Define a constant in Python C extension

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

fredbasset1000 at 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.


More information about the Python-list mailing list