Instance Method Objects

An instance method is a wrapper for aPyCFunction and the new wayto bind aPyCFunction to a class object. It replaces the former callPyMethod_New(func,NULL,class).

PyTypeObjectPyInstanceMethod_Type

This instance ofPyTypeObject represents the Python instancemethod type. It is not exposed to Python programs.

intPyInstanceMethod_Check(PyObject*o)

Return true ifo is an instance method object (has typePyInstanceMethod_Type). The parameter must not beNULL.This function always succeeds.

PyObject*PyInstanceMethod_New(PyObject*func)
Επιστρεφόμενη τιμή: New reference.

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

PyObject*PyInstanceMethod_Function(PyObject*im)
Επιστρεφόμενη τιμή: Borrowed reference.

Return the function object associated with the instance methodim.

PyObject*PyInstanceMethod_GET_FUNCTION(PyObject*im)
Επιστρεφόμενη τιμή: Borrowed reference.

Macro version ofPyInstanceMethod_Function() which avoids error checking.

Method Objects

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

PyTypeObjectPyMethod_Type

This instance ofPyTypeObject represents the Python method type. Thisis exposed to Python programs astypes.MethodType.

intPyMethod_Check(PyObject*o)

Return true ifo is a method object (has typePyMethod_Type). Theparameter must not beNULL. This function always succeeds.

PyObject*PyMethod_New(PyObject*func,PyObject*self)
Επιστρεφόμενη τιμή: New reference.

Return a new method object, withfunc being any callable object andselfthe instance the method should be bound.func is the function that willbe called when the method is called.self must not beNULL.

PyObject*PyMethod_Function(PyObject*meth)
Επιστρεφόμενη τιμή: Borrowed reference.

Return the function object associated with the methodmeth.

PyObject*PyMethod_GET_FUNCTION(PyObject*meth)
Επιστρεφόμενη τιμή: Borrowed reference.

Macro version ofPyMethod_Function() which avoids error checking.

PyObject*PyMethod_Self(PyObject*meth)
Επιστρεφόμενη τιμή: Borrowed reference.

Return the instance associated with the methodmeth.

PyObject*PyMethod_GET_SELF(PyObject*meth)
Επιστρεφόμενη τιμή: Borrowed reference.

Macro version ofPyMethod_Self() which avoids error checking.