March 2003
Intermediate to advanced
656 pages
39h 30m
English
PyModule_AddStringConstant
int PyModule_AddStringConstant(PyObject*module,char*name,char*value)
Adds to module module an attribute named
name with string value
value.
Some module initialization operations may be conveniently performed
by executing Python code with PyRun_String,
covered later in Section 24.3.4, with
the module’s dictionary as both the
globals and
locals argument. If you find yourself
using PyRun_String extensively, rather than just
as an occasional convenience, consider the possibility of splitting
your extension module in two: a C-coded extension module offering
raw, fast functionality, and a Python module wrapping the C-coded
extension to provide further convenience and handy utilities.
When you do need to get a module’s dictionary, use
the PyModule_GetDict function.
Read now
Unlock full access