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. symtable provides an interface to examine these tables.
A namespace table for a block. The constructor is not public.
A namespace for a function or method. This class inherits SymbolTable.
A namespace of a class. This class inherits SymbolTable.
An entry in a SymbolTable corresponding to an identifier in the source. The constructor is not public.
Return True if name binding introduces new namespace.
If the name is used as the target of a function or class statement, this will be true.
For example:
>>> table = symtable.symtable("def some_func(): pass", "string", "exec") >>> table.lookup("some_func").is_namespace() True
Note that a single name can be bound to multiple objects. If the result is True, the name may also be bound to other objects, like an int or list, that does not introduce a new namespace.
30.2. ast — Abstract Syntax Trees
30.4. symbol — Constants used with Python parse trees
Enter search terms or a module, class or function name.