diff options
author | Guido van Rossum <guido@python.org> | 2001-09-29 14:28:52 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-09-29 14:28:52 (GMT) |
commit | 0d68246f01304a3318f8753b88a32585db614406 (patch) | |
tree | 1fb637b9786fa5fe4ece967398b53c401fee046d /Doc/lib/libfuncs.tex | |
parent | a1c3662e8433e0290816d85b82b2291f54ee6062 (diff) | |
download | cpython-0d68246f01304a3318f8753b88a32585db614406.zip cpython-0d68246f01304a3318f8753b88a32585db614406.tar.gz cpython-0d68246f01304a3318f8753b88a32585db614406.tar.bz2 |
Fix two typos in the text about compile(), and add two caveats from
recent user feedback: you must end the input with \n and you must use
\n, not \r\n to represent line endings.
Diffstat (limited to 'Doc/lib/libfuncs.tex')
-rw-r--r-- | Doc/lib/libfuncs.tex | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index c2dae1a..2eca466 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -123,7 +123,7 @@ class instances are callable if they have a \method{__call__()} method. Compile the \var{string} into a code object. Code objects can be executed by an \keyword{exec} statement or evaluated by a call to \function{eval()}. The \var{filename} argument should - give the file from which the code was read; pass same recognizable value + give the file from which the code was read; pass some recognizable value if it wasn't read from a file (\code{'<string>'} is commonly used). The \var{kind} argument specifies what kind of code must be compiled; it can be \code{'exec'} if \var{string} consists of a @@ -132,7 +132,14 @@ class instances are callable if they have a \method{__call__()} method. interactive statement (in the latter case, expression statements that evaluate to something else than \code{None} will printed). - The optional arguments \var{flags} and \optional{dont_inherit} + When compiling multi-line statements, two caveats apply: line + endings must be represented by a single newline character + (\code{'\e n'}), and the input must be terminated by at least one + newline character. If line endings are represented by + \code{'\e r\e n'}, use the string \method{replace()} method to + change them into \code{'\e n'}. + + The optional arguments \var{flags} and \var{dont_inherit} (which are new in Python 2.2) control which future statements (see \pep{236}) affect the compilation of \var{string}. If neither is present (or both are zero) the code is compiled with those future |