Runtime Data Attributes

frame.f_code

Code object executed by the frame, distinct from the function object. Read access can trigger a runtime audit event.

Formal Syntax & Structure

python syntaxpython
frame.f_code

Return Value

types.CodeType

Value exposed by this attribute; availability and mutability depend on the owner as described.

Working Example

Example Snippetpython
import inspectdef f(): return inspect.currentframe().f_codeprint(f() is f.__code__)
Python Reference