Runtime Types

types.FunctionType — runtime type

Identifies functions defined by def or lambda, not every callable. Direct construction takes a code object and globals, with optional name, defaults and closure; prefer ordinary definitions. Closure cells and globals are part of the function environment. Direct construction is audited.

Formal Syntax & Structure

python syntaxpython
types.FunctionType

Return Value

type

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

Working Example

Example Snippetpython
import typesdef total(a, b=2):    return a+bvalue = totalprint(isinstance(value, types.FunctionType))
Python Reference