인스턴스 메서드 객체

인스턴스 메서드는 PyCFunction에 대한 래퍼이며 PyCFunction를 클래스 객체에 연결하는 새로운 방법입니다. 이전의 PyMethod_New(func, NULL, class) 호출을 대체합니다.

PyTypeObject PyInstanceMethod_Type

PyTypeObject 인스턴스는 파이썬 인스턴스 메서드 형을 나타냅니다. 파이썬 프로그램에는 노출되지 않습니다.

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_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()의 매크로 버전.

메서드 객체

메서드는 연결된(bound) 함수 객체입니다. 메서드는 항상 사용자 정의 클래스의 인스턴스에 연결됩니다. 연결되지 않은(unbound) 메서드(클래스 객체에 연결된 메서드)는 더는 사용할 수 없습니다.

PyTypeObject PyMethod_Type

PyTypeObject 인스턴스는 파이썬 메서드 형을 나타냅니다. 이것은 파이썬 프로그램에 types.MethodType로 노출됩니다.

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_Function(PyObject *meth)
Return value: Borrowed reference.

meth 메서드와 연관된 함수 객체를 반환합니다.

PyObject* PyMethod_GET_FUNCTION(PyObject *meth)
Return value: Borrowed reference.

오류 검사를 피하는 PyMethod_Function()의 매크로 버전.

PyObject* PyMethod_Self(PyObject *meth)
Return value: Borrowed reference.

meth 메서드와 연관된 인스턴스를 반환합니다.

PyObject* PyMethod_GET_SELF(PyObject *meth)
Return value: Borrowed reference.

오류 검사를 피하는 PyMethod_Self()의 매크로 버전.

int PyMethod_ClearFreeList()

자유 목록을 지웁니다. 해제된 총 항목 수를 반환합니다.