开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜