fredbasset1...@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
--
fredbasset1...@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?
There's an API function to create a module-level name with a given value,
e.g.
PyModule_AddIntConstant (module, "S_IRUSR", S_IRUSR); //
On 2009-02-27 14:54, fredbasset1...@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?
In your init function, create Python objects from the constants
and insert them into the module using PyModule_AddObjec