Skip to main content

Overview

Python provides utility functions for parsing arguments and building return values.

Argument Parsing

PyArg_ParseTuple

Parse positional arguments. Format codes:
  • s - String (char*)
  • i - Integer (int)
  • l - Long (long)
  • d - Double (double)
  • O - PyObject*
  • | - Optional arguments follow
Example:

PyArg_ParseTupleAndKeywords

Example:

Building Values

Py_BuildValue

Build Python objects from C values. Example:

Import Functions

Example:

See Also