symtable.rst 4.85 KB

:mod:`symtable` --- Access to the compiler's symbol tables

Source code: :source:`Lib/symtable.py`


Symbol tables are generated by the compiler from AST just before bytecode is generated. The symbol table is responsible for calculating the scope of every identifier in the code. :mod:`symtable` provides an interface to examine these tables.

Generating Symbol Tables

Examining Symbol Tables

A namespace table for a block. The constructor is not public.

A namespace for a function or method. This class inherits :class:`SymbolTable`.

A namespace of a class. This class inherits :class:`SymbolTable`.

An entry in a :class:`SymbolTable` corresponding to an identifier in the source. The constructor is not public.