@@ -47,8 +47,11 @@ \section{Built-in Functions}
4747 give the file from which the code was read; pass e.g. \code {'<string>'}
4848 if it wasn't read from a file. The \var {kind} argument specifies
4949 what kind of code must be compiled; it can be \code {'exec'} if
50- \var {string} consists of a sequence of statements, or \code {'eval'}
51- if it consists of a single expression.
50+ \var {string} consists of a sequence of statements, \code {'eval'}
51+ if it consists of a single expression, or \code {'single'} if
52+ it consists of a single interactive statement (in the latter case,
53+ expression statements that evaluate to something else than
54+ \code {None} will printed).
5255\end {funcdesc }
5356
5457\begin {funcdesc }{delattr}{object\, name}
@@ -112,8 +115,9 @@ \section{Built-in Functions}
112115
113116 Hints: dynamic execution of statements is supported by the
114117 \code {exec} statement. Execution of statements from a file is
115- supported by the \code {execfile()} function. The \code {vars()}
116- function returns the current local dictionary, which may be useful
118+ supported by the \code {execfile()} function. The \code {globals()}
119+ and \code {locals()} functions returns the current global and local
120+ dictionary, respectively, which may be useful
117121 to pass around for use by \code {eval()} or \code {execfile()}.
118122
119123\end {funcdesc }
@@ -158,6 +162,13 @@ \section{Built-in Functions}
158162 \code {\var {x}.\var {foobar}}.
159163\end {funcdesc }
160164
165+ \begin {funcdesc }{globals}{}
166+ Return a dictionary representing the current global symbol table.
167+ This is always the dictionary of the current module (inside a
168+ function or method, this is the module where it is defined, not the
169+ module from which it is called).
170+ \end {funcdesc }
171+
161172\begin {funcdesc }{hasattr}{object\, name}
162173 The arguments are an object and a string. The result is 1 if the
163174 string is the name of one of the object's attributes, 0 if not.
@@ -206,6 +217,12 @@ \section{Built-in Functions}
206217 may be a sequence (string, tuple or list) or a mapping (dictionary).
207218\end {funcdesc }
208219
220+ \begin {funcdesc }{locals}{}
221+ Return a dictionary representing the current local symbol table.
222+ Inside a function, modifying this dictionary does not always have the
223+ desired effect.
224+ \end {funcdesc }
225+
209226\begin {funcdesc }{long}{x}
210227 Convert a number to a long integer. The argument may be a plain or
211228 long integer or a floating point number.
0 commit comments