Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 38c28e3

Browse files
committed
Added a note to the section on 'exec' about the need for a trailing newline
in certain circumstances. (Apparently, this is a CPython problem.)
1 parent 6a647bb commit 38c28e3

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Doc/ref/ref6.tex

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ \section{Assignment statements \label{assignment}}
227227
\indexii{slicing}{assignment}
228228

229229
\end{itemize}
230-
230+
231231
(In the current implementation, the syntax for targets is taken
232232
to be the same as for expressions, and invalid syntax is rejected
233233
during the code generation phase, causing less detailed error
@@ -612,3 +612,12 @@ \section{The \keyword{exec} statement \label{exec}}
612612
\bifuncindex{eval}
613613
\bifuncindex{globals}
614614
\bifuncindex{locals}
615+
616+
Also, in the current implementation, multi-line compound statements must
617+
end with a newline:
618+
\code{exec "for v in seq:\e{}n\e{}tprint v\e{}n"} works, but
619+
\code{exec "for v in seq:\e{}n\e{}tprint v"} fails with
620+
\exception{SyntaxError}.
621+
\exindex{SyntaxError}
622+
623+

0 commit comments

Comments
 (0)