Module python_ast::scope

source ·

Enums

  • Python uses LEGB scope: Local, Enclosing, Global, and Built-in. Local scope consists of local variables inside a function. Names in the local scope may change new declarations overwrite older ones. Enclosing scope is the scope of a containing function with inner/nested functions. Global is the global scope. Names within the global namespace must be unique. Built-in is basically a special scope for elements that are built into Python.
  • Represents a single symbol within a scope.