First page Back Continue Last page Overview Graphics

Wrapper Function

PyArg_ParseTuple(args, "i:fact", &n)

parses the parameters of a function that takes only positional parameters into local variables. Returns true on success; on failure, it returns false and raises the appropriate exception.

The args argument must be a tuple object containing an argument list passed from Python to a C function. "i:fact" is the format string

The following arguments are addresses of variables whose type is determined by the format string, in our case only &n

The format string "i:fact" defines that n must be an integer (the i in front of the colon) defines the error message, which will be used instead of the default error message.


Notes:

https://docs.python.org/2.0/ext/parseTuple.html