Runtime Types

types.MethodType — runtime type

A bound user-defined method combines the function with an instance (or class for a classmethod). Calling it supplies the bound receiver. MethodType(function, instance) creates such a binding explicitly; inspect __func__ and __self__ rather than assuming it is a plain function.

Formal Syntax & Structure

python syntaxpython
types.MethodType

Return Value

type

The class object types.MethodType; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
import typesclass Meter:    def read(self): return 7meter=Meter()value = meter.readprint(isinstance(value, types.MethodType))
Python Reference