On this page
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
- Returns the live module-level dict: Mutating it mutates module globals directly.
REPL Inspect
help(globals)
Linked from
- tuts/python3/__builtins__
- tuts/python3/__builtins__/__builtins__
- tuts/python3/__builtins__/breakpoint
- tuts/python3/__builtins__/compile
- tuts/python3/__builtins__/eval
- tuts/python3/__builtins__/exec
- tuts/python3/__builtins__/getattr
- tuts/python3/__builtins__/hasattr
- tuts/python3/__builtins__/input
- tuts/python3/__builtins__/locals
- tuts/python3/__builtins__/open
- tuts/python3/__builtins__/print
Related notes
- tuts/python3/__builtins__/__builtins__ Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/breakpoint Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/compile Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/eval Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/exec Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/getattr Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/hasattr Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__/input Linked here; links to this page; shared tags: #builtins
- tuts/python3/__builtins__ links to this page; shared tags: #builtins
- tuts/python3/__builtins__/locals links to this page; shared tags: #builtins