Runtime Data Attributes

function.__globals__

Live defining global namespace. The attribute cannot be rebound; changing entries can alter global name lookups. Avoid exposing sensitive globals.

Formal Syntax & Structure

python syntaxpython
f.__globals__

Return Value

dict

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

Working Example

Example Snippetpython
rate = 3def f(): return rateprint(f.__globals__['rate'])
Python Reference