Define a constant in Python C extension
Mel
mwilson at the-wire.com
Fri Feb 27 16:15:18 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?
There's an API function to create a module-level name with a given value,
e.g.
PyModule_AddIntConstant (module, "S_IRUSR", S_IRUSR); // user read
In this example, S_IRUSR was defined in one of the .h files for the
functions being wrapped.
Mel.
More information about the Python-list
mailing list