PyMethodDef's Crucial Trio: Name, Function, Flags

To expose C functions to Python, every extension uses an array of `PyMethodDef` structs. The three most vital fields within each `PyMethodDef` are `ml_name` (the function's Python-facing name), `ml_meth` (a pointer to the C implementation), and `ml_flags` (specifying the calling convention, e.g., `METH_VARARGS` or `METH_KEYWORDS`).

Sources

Open the full topic