Python实例方法对象

实例方法是 PyCFunction 的包装器,也是将 PyCFunction 绑定到类对象的一种新方式。 它替代了原先的调用 PyMethod_New(func,NULL,class)。
- PyTypeObject - PyInstanceMethod_Type¶
- 这个 - PyTypeObject实例代表 Python 实例方法类型。 它并不对 Python 程序公开。
- int - PyInstanceMethod_Check(PyObject *o)¶
- 如果 o 是实例方法对象 (类型为 - PyInstanceMethod_Type) 则返回真值。 形参必须不为- NULL。
- PyObject* - PyInstanceMethod_New(PyObject *func)¶
- Return value: New reference.返回一个新的实例方法对象,func 应为任意可调用对象,func 将在实例方法被调用时作为函数被调用。 
- PyObject* - PyInstanceMethod_Function(PyObject *im)¶
- Return value: Borrowed reference.返回关联到实例方法 im 的函数对象。 
- PyObject* - PyInstanceMethod_GET_FUNCTION(PyObject *im)¶
- Return value: Borrowed reference.宏版本的 PyInstanceMethod_Function(),略去了错误检测。






