March 2003
Intermediate to advanced
656 pages
39h 30m
English
compile
compile(string,filename,kind)
Compiles a string and returns a code object usable by
exec or eval.
compile raises SyntaxError when
string is not syntactically valid Python.
When string is a multiline compound
statement, the last character must be '\n‘.
kind must be 'eval'
when string is an expression and the
result is meant for eval, otherwise
kind must be 'exec‘.
filename must be a string, and is used
only in error messages (if and when errors occur). See also
eval in this section and Section 13.1.