How do I read the arguments in "args" passed to a builtin function in Python [source]?
Example (builtinmodule.c):
static PyObject *
builtin___import__(PyObject *self, PyObject *args, PyObject *kwds)
{
...
}
How do I go about getting the arguments, args
, in string format? I believe it would be similar to finding the name of a function (if a ca开发者_JAVA百科llable PyObject was a function: PyString_AsString(PyObject_GetAttrString(func, "__name__"))
), but I don't know what attributes to look for in the args
.
The easiest thing to do is just get the repr of the object, since it's a tuple.
精彩评论