#include static char third_doc[] = "This module is just a simple example."; static PyObject* third_addi(PyObject *self, PyObject *args) { long a, b; if (!PyArg_ParseTuple(args, "ll:addi", &a, &b)) { return NULL; } return PyInt_FromLong(a + b); } static char third_addi_doc[] = "addi(a, b) -> int\n\ \n\ Return the sum of integers a and b."; static PyObject* third_addf(PyObject *self, PyObject *args) { double a, b; if (!PyArg_ParseTuple(args, "dd:addf", &a, &b)) { return NULL; } return PyFloat_FromDouble(a + b); } static char third_addf_doc[] = "addf(a, b) -> floats\n\ \n\ Return the sum of floats a and b."; static PyMethodDef third_methods[] = { {"addi", third_addi, METH_VARARGS, third_addi_doc}, {"addf", third_addf, METH_VARARGS, third_addf_doc}, {NULL, NULL} }; PyMODINIT_FUNC initthird(void) { Py_InitModule3("third", third_methods, third_doc); }