This documentation http://docs.python.org/2/c-api/arg.html#PyArg_UnpackTuple describes all the parameters of function, except for const char *name
.
What is this parameter for? What should I put there and why?
foo("string") passes a Python str object to a C function which will later assign the string to char *c_ptr .
The terms parameter and argument can be used for the same thing: information that are passed into a function. From a function's perspective: A parameter is the variable listed inside the parentheses in the function definition. An argument is the value that are sent to the function when it is called.
A PyObject is in fact just a Python object at the C level. And since integers in Python are objects, they are also PyObject s. It doesn't matter whether it was written in Python or in C, it is a PyObject at the C level regardless.
Almost the entire Python interpreter can be summarized into one C-level function: PyEval_EvalFrameEx. This function is the interpreter loop. Consisting of 3k lines of code, its job is to evaluate a frame, or in other words, run it.
According to the Python source (Python/getargs.c), the name argument is used when raising exceptions. So it could be the name of the function/method in which you use PyArg_UnpackTuple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With