March 2003
Intermediate to advanced
656 pages
39h 30m
English
eval
eval(expr,[globals[,locals]])
Returns the result of an expression. expr
may be a code object ready for evaluation or a string. In the case of
a string, eval gets a code object by calling
compile(
expr,
'string',
'eval'). eval evaluates the
code object as an expression, using the
globals and
locals dictionaries as namespaces. When
both arguments are missing, eval uses the current
namespace. eval cannot execute statements; it can
only evaluate expressions. For more information on
eval, see Chapter 13.