2012-10-12 42 views

回答

1

PyMethodDef中使用METH_STATIC标志。该方法将作为第一个参数而不是该类型的实例传递NULL。

static PyMethodDef FooMethods[] = 
{ 
    {"__init__", Foo_init, METH_VARARGS, 
    "doc string"}, 
    {"doSomething", Foo_doSomething, METH_VARARGS | METH_STATIC, 
    "doc string"}, 
    {NULL}, 
};