内容表

  • 实例方法对象
  • 方法对象
  • 就业培训     下载中心     Wiki     联络
    登录   注册

    Log
    1. 首页
    2. Python 3.12.4
    3. 索引
    4. 模块
    5. 下一
    6. 上一
    7. Python/C API 参考手册
    8. 具体对象层
    9. 实例方法对象

    实例方法对象 ¶

    An instance method is a wrapper for a PyCFunction and the new way to bind a PyCFunction to a class object. It replaces the former call PyMethod_New(func, NULL, class) .

    PyTypeObject PyInstanceMethod_Type ¶

    此实例的 PyTypeObject represents the Python instance method type. It is not exposed to Python programs.

    int PyInstanceMethod_Check ( PyObject * o ) ¶

    返回 True 若 o is an instance method object (has type PyInstanceMethod_Type ). The parameter must not be NULL . This function always succeeds.

    PyObject * PyInstanceMethod_New ( PyObject * func ) ¶
    返回值:新引用。

    Return a new instance method object, with func being any callable object. func is the function that will be called when the instance method is called.

    PyObject * PyInstanceMethod_Function ( PyObject * im ) ¶
    返回值:借位引用。

    Return the function object associated with the instance method im .

    PyObject * PyInstanceMethod_GET_FUNCTION ( PyObject * im ) ¶
    返回值:借位引用。

    Macro version of PyInstanceMethod_Function() which avoids error checking.

    方法对象 ¶

    Methods are bound function objects. Methods are always bound to an instance of a user-defined class. Unbound methods (methods bound to a class object) are no longer available.

    PyTypeObject PyMethod_Type ¶

    此实例的 PyTypeObject represents the Python method type. This is exposed to Python programs as types.MethodType .

    int PyMethod_Check ( PyObject * o ) ¶

    返回 True 若 o is a method object (has type PyMethod_Type ). The parameter must not be NULL . This function always succeeds.

    PyObject * PyMethod_New ( PyObject * func , PyObject * self ) ¶
    返回值:新引用。

    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 不得为 NULL .

    PyObject * PyMethod_Function ( PyObject * meth ) ¶
    返回值:借位引用。

    Return the function object associated with the method meth .

    PyObject * PyMethod_GET_FUNCTION ( PyObject * meth ) ¶
    返回值:借位引用。

    Macro version of PyMethod_Function() which avoids error checking.

    PyObject * PyMethod_Self ( PyObject * meth ) ¶
    返回值:借位引用。

    Return the instance associated with the method meth .

    PyObject * PyMethod_GET_SELF ( PyObject * meth ) ¶
    返回值:借位引用。

    Macro version of PyMethod_Self() which avoids error checking.

    内容表

    • 实例方法对象
    • 方法对象

    上一话题

    函数对象

    下一话题

    单元格对象

    本页

    • 报告 Bug
    • 展示源

    快速搜索

    键入搜索术语或模块、类、函数名称。

    1. 首页
    2. Python 3.12.4
    3. 索引
    4. 模块
    5. 下一
    6. 上一
    7. Python/C API 参考手册
    8. 具体对象层
    9. 实例方法对象

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1