GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • index
  • modules
  • next
  • previous
  • Python
  • 3.4.10 Documentation
  • Python/C API Reference Manual
  • Concrete Objects Layer
  • Instance Method Objects
  • Report a Bug
  • Show Source

This view

  • Original page
  • New address

GeezerVison is showing docs.python.org — Instance Method Objects — Python 3.4.10 documentation

This document is for an old version of Python that is no longer supported. You should upgrade, and read the Python documentation for the current stable release.

Navigation

  • index
  • modules |
  • next |
  • previous |
  • Python »
  • 3.4.10 Documentation »
  • Python/C API Reference Manual »
  • Concrete Objects Layer »

Instance Method Objects¶

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¶

This instance of PyTypeObject represents the Python instance method type. It is not exposed to Python programs.

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 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.

Method Objects¶

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

PyTypeObject PyMethod_Type¶

This instance of PyTypeObject represents the Python method type. This is exposed to Python programs as 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.

Return the function object associated with the method meth.

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

Macro version of PyMethod_Function() which avoids error checking.

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

Return the instance associated with the method meth.

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

Macro version of PyMethod_Self() which avoids error checking.

int PyMethod_ClearFreeList()¶

Clear the free list. Return the total number of freed items.

Table Of Contents

  • Instance Method Objects
  • Method Objects

Previous topic

Function Objects

Next topic

Cell Objects

This Page

  • Report a Bug
  • Show Source

Quick search

Enter search terms or a module, class or function name.

Navigation

  • index
  • modules |
  • next |
  • previous |
  • Python »
  • 3.4.10 Documentation »
  • Python/C API Reference Manual »
  • Concrete Objects Layer »
© Copyright 1990-2019, Python Software Foundation.
The Python Software Foundation is a non-profit corporation. Please donate.
Last updated on Jun 16, 2019. Found a bug?
Created using Sphinx 1.2.3.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.