实例方法对象¶
实例方法是 PyCFunction 的包装器,也是将 PyCFunction 绑定到类对象的一种新方式。 它替代了原先的调用 PyMethod_New(func, NULL, class)。
- 
PyTypeObject PyInstanceMethod_Type¶
- 这个 - PyTypeObject实例代表 Python 实例方法类型。 它并不对 Python 程序公开。
- 
int PyInstanceMethod_Check(PyObject *o)¶
- Return true if o is an instance method object (has type - PyInstanceMethod_Type). The parameter must not be NULL.
- 
PyObject* PyInstanceMethod_GET_FUNCTION(PyObject *im)¶
- 宏版本的 - PyInstanceMethod_Function(),略去了错误检测。
方法对象¶
方法是绑定的函数对象。 方法总是会被绑定到一个用户自定义类的实例。 未绑定方法(绑定到一个类的方法)已不再可用。
- 
PyTypeObject PyMethod_Type¶
- 这个 - PyTypeObject实例代表 Python 方法类型。 它作为- types.MethodType向 Python 程序公开。
- 
int PyMethod_Check(PyObject *o)¶
- Return true if o is a method object (has type - PyMethod_Type). The parameter must not be NULL.
- 
PyObject* PyMethod_New(PyObject *func, PyObject *self)¶
- Return value: New reference.Return a new method object, with func being any callable object and self the instance the method should be bound. func is the function that will be called when the method is called. self must not be NULL. 
- 
PyObject* PyMethod_GET_FUNCTION(PyObject *meth)¶
- Return value: Borrowed reference.宏版本的 PyMethod_Function(),略去了错误检测。
- 
PyObject* PyMethod_GET_SELF(PyObject *meth)¶
- Return value: Borrowed reference.宏版本的 PyMethod_Self(),省略了错误检测。
- 
int PyMethod_ClearFreeList()¶
- 清空释放列表。 返回所释放的条目数。 
