💾 Archived View for tris.fyi › pydoc › symtable captured on 2023-01-29 at 03:34:28. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-01-08)
-=-=-=-=-=-=-
Interface to the compiler's internal symbol tables
get_children(self) Return a list of the nested symbol tables.
get_id(self) Return an identifier for the table.
get_identifiers(self) Return a view object containing the names of symbols in the table.
get_lineno(self) Return the number of the first line in the block for the table.
get_methods(self) Return a tuple of methods declared in the class.
get_name(self) Return the table's name. This corresponds to the name of the class, function or 'top' if the table is for a class, function or global respectively.
get_symbols(self) Return a list of *Symbol* instances for names in the table.
get_type(self) Return the type of the symbol table. The values retuned are 'class', 'module' and 'function'.
has_children(self) Return *True* if the block has nested namespaces.
is_nested(self) Return *True* if the block is a nested class or function.
is_optimized(self) Return *True* if the locals in the table are optimizable.
lookup(self, name) Lookup a *name* in the table. Returns a *Symbol* instance.
get_children(self) Return a list of the nested symbol tables.
get_frees(self) Return a tuple of free variables in the function.
get_globals(self) Return a tuple of globals in the function.
get_id(self) Return an identifier for the table.
get_identifiers(self) Return a view object containing the names of symbols in the table.
get_lineno(self) Return the number of the first line in the block for the table.
get_locals(self) Return a tuple of locals in the function.
get_name(self) Return the table's name. This corresponds to the name of the class, function or 'top' if the table is for a class, function or global respectively.
get_nonlocals(self) Return a tuple of nonlocals in the function.
get_parameters(self) Return a tuple of parameters to the function.
get_symbols(self) Return a list of *Symbol* instances for names in the table.
get_type(self) Return the type of the symbol table. The values retuned are 'class', 'module' and 'function'.
has_children(self) Return *True* if the block has nested namespaces.
is_nested(self) Return *True* if the block is a nested class or function.
is_optimized(self) Return *True* if the locals in the table are optimizable.
lookup(self, name) Lookup a *name* in the table. Returns a *Symbol* instance.
get_name(self) Return a name of a symbol.
get_namespace(self) Return the single namespace bound to this name. Raises ValueError if the name is bound to multiple namespaces.
get_namespaces(self) Return a list of namespaces bound to this name
is_annotated(self) Return *True* if the symbol is annotated.
is_assigned(self) Return *True* if a symbol is assigned to.
is_declared_global(self) Return *True* if the symbol is declared global with a global statement.
is_free(self) Return *True* if a referenced symbol is not assigned to.
is_global(self) Return *True* if the sysmbol is global.
is_imported(self) Return *True* if the symbol is created from an import statement.
is_local(self) Return *True* if the symbol is local.
is_namespace(self) Returns *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. Note that a single name can be bound to multiple objects. If is_namespace() is true, the name may also be bound to other objects, like an int or list, that does not introduce a new namespace.
is_nonlocal(self) Return *True* if the symbol is nonlocal.
is_parameter(self) Return *True* if the symbol is a parameter.
is_referenced(self) Return *True* if the symbol is used in its block.
get_children(self) Return a list of the nested symbol tables.
get_id(self) Return an identifier for the table.
get_identifiers(self) Return a view object containing the names of symbols in the table.
get_lineno(self) Return the number of the first line in the block for the table.
get_name(self) Return the table's name. This corresponds to the name of the class, function or 'top' if the table is for a class, function or global respectively.
get_symbols(self) Return a list of *Symbol* instances for names in the table.
get_type(self) Return the type of the symbol table. The values retuned are 'class', 'module' and 'function'.
has_children(self) Return *True* if the block has nested namespaces.
is_nested(self) Return *True* if the block is a nested class or function.
is_optimized(self) Return *True* if the locals in the table are optimizable.
lookup(self, name) Lookup a *name* in the table. Returns a *Symbol* instance.
new(self, table, filename)
symtable(code, filename, compile_type) Return the toplevel *SymbolTable* for the source code. *filename* is the name of the file with the code and *compile_type* is the *compile()* mode argument.
CELL = 5
DEF_ANNOT = 256
DEF_BOUND = 134
DEF_GLOBAL = 1
DEF_IMPORT = 128
DEF_LOCAL = 2
DEF_NONLOCAL = 8
DEF_PARAM = 4
FREE = 4
GLOBAL_EXPLICIT = 2
GLOBAL_IMPLICIT = 3
LOCAL = 1
SCOPE_MASK = 15
SCOPE_OFF = 11
USE = 16