On this page
  1. globals
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

globals

Prev: getattr | Up: __builtins__ | Next: hasattr
Rel: breakpoint, compile, eval, exec, input
Ref: docs.python.org — globals
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import globals

Overview & Signature

globals()

Return the dictionary containing the current scope's global variables.

Usage

g = globals()
assert isinstance(g, dict) and "__builtins__" in g

Gotchas

REPL Inspect

help(globals)

Linked from

Related notes