Added a note to the section on 'exec' about the need for a trailing newline

in certain circumstances.  (Apparently, this is a CPython problem.)
This commit is contained in:
Greg Ward 2000-04-27 18:32:02 +00:00
parent 6a647bb910
commit 38c28e379c
1 changed files with 10 additions and 1 deletions

View File

@ -227,7 +227,7 @@ target sequence, if the object allows it.
\indexii{slicing}{assignment} \indexii{slicing}{assignment}
\end{itemize} \end{itemize}
(In the current implementation, the syntax for targets is taken (In the current implementation, the syntax for targets is taken
to be the same as for expressions, and invalid syntax is rejected to be the same as for expressions, and invalid syntax is rejected
during the code generation phase, causing less detailed error during the code generation phase, causing less detailed error
@ -612,3 +612,12 @@ for use by \keyword{exec}.
\bifuncindex{eval} \bifuncindex{eval}
\bifuncindex{globals} \bifuncindex{globals}
\bifuncindex{locals} \bifuncindex{locals}
Also, in the current implementation, multi-line compound statements must
end with a newline:
\code{exec "for v in seq:\e{}n\e{}tprint v\e{}n"} works, but
\code{exec "for v in seq:\e{}n\e{}tprint v"} fails with
\exception{SyntaxError}.
\exindex{SyntaxError}