Next / Previous / Contents / TCC Help System / NM Tech homepage

14.22. vars(): Local variables

This function returns a dictionary that represents a symbol table: its keys are variable names, and each key's corresponding value is its bound value. The official documentation warns you not to change anything in this dictionary, or Bad Things Will Happen.

There are two forms of call:

vars()

Returns the local symbol table.

vars(ns)

Returns the symbol table of a namespace ns, where a namespace can be a module, an instance, or a class.

Compare the similar functions Section 14.5, “dir(): Display a namespace's names”, Section 14.14, “locals(): Dictionary of local name bindings”, and Section 14.9, “globals(): Dictionary of global name bindings”.