diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libdis.tex | 21 | ||||
-rw-r--r-- | Doc/ref/ref6.tex | 55 |
2 files changed, 0 insertions, 76 deletions
diff --git a/Doc/lib/libdis.tex b/Doc/lib/libdis.tex index e61ca36..3f00fa8 100644 --- a/Doc/lib/libdis.tex +++ b/Doc/lib/libdis.tex @@ -353,27 +353,6 @@ removed from the stack and printed. In non-interactive mode, an expression statement is terminated with \code{POP_STACK}. \end{opcodedesc} -\begin{opcodedesc}{PRINT_ITEM}{} -Prints TOS to the file-like object bound to \code{sys.stdout}. There -is one such instruction for each item in the \keyword{print} statement. -\end{opcodedesc} - -\begin{opcodedesc}{PRINT_ITEM_TO}{} -Like \code{PRINT_ITEM}, but prints the item second from TOS to the -file-like object at TOS. This is used by the extended print statement. -\end{opcodedesc} - -\begin{opcodedesc}{PRINT_NEWLINE}{} -Prints a new line on \code{sys.stdout}. This is generated as the -last operation of a \keyword{print} statement, unless the statement -ends with a comma. -\end{opcodedesc} - -\begin{opcodedesc}{PRINT_NEWLINE_TO}{} -Like \code{PRINT_NEWLINE}, but prints the new line on the file-like -object on the TOS. This is used by the extended print statement. -\end{opcodedesc} - \begin{opcodedesc}{BREAK_LOOP}{} Terminates a loop due to a \keyword{break} statement. \end{opcodedesc} diff --git a/Doc/ref/ref6.tex b/Doc/ref/ref6.tex index c1bbd9b..4c7487b 100644 --- a/Doc/ref/ref6.tex +++ b/Doc/ref/ref6.tex @@ -12,7 +12,6 @@ by semicolons. The syntax for simple statements is: \productioncont{| \token{augmented_assignment_stmt}} \productioncont{| \token{pass_stmt}} \productioncont{| \token{del_stmt}} - \productioncont{| \token{print_stmt}} \productioncont{| \token{return_stmt}} \productioncont{| \token{yield_stmt}} \productioncont{| \token{raise_stmt}} @@ -370,60 +369,6 @@ right type (but even this is determined by the sliced object). \indexii{attribute}{deletion} -\section{The \keyword{print} statement \label{print}} -\stindex{print} - -\begin{productionlist} - \production{print_stmt} - {"print" ( \optional{\token{expression} ("," \token{expression})* \optional{","}}} - \productioncont{| ">>" \token{expression} - \optional{("," \token{expression})+ \optional{","}} )} -\end{productionlist} - -\keyword{print} evaluates each expression in turn and writes the -resulting object to standard output (see below). If an object is not -a string, it is first converted to a string using the rules for string -conversions. The (resulting or original) string is then written. A -space is written before each object is (converted and) written, unless -the output system believes it is positioned at the beginning of a -line. This is the case (1) when no characters have yet been written -to standard output, (2) when the last character written to standard -output is \character{\e n}, or (3) when the last write operation on -standard output was not a \keyword{print} statement. (In some cases -it may be functional to write an empty string to standard output for -this reason.) \note{Objects which act like file objects but which are -not the built-in file objects often do not properly emulate this -aspect of the file object's behavior, so it is best not to rely on -this.} -\index{output} -\indexii{writing}{values} - -A \character{\e n} character is written at the end, unless the -\keyword{print} statement ends with a comma. This is the only action -if the statement contains just the keyword \keyword{print}. -\indexii{trailing}{comma} -\indexii{newline}{suppression} - -Standard output is defined as the file object named \code{stdout} -in the built-in module \module{sys}. If no such object exists, or if -it does not have a \method{write()} method, a \exception{RuntimeError} -exception is raised. -\indexii{standard}{output} -\refbimodindex{sys} -\withsubitem{(in module sys)}{\ttindex{stdout}} -\exindex{RuntimeError} - -\keyword{print} also has an extended\index{extended print statement} -form, defined by the second portion of the syntax described above. -This form is sometimes referred to as ``\keyword{print} chevron.'' -In this form, the first expression after the \code{>>} must -evaluate to a ``file-like'' object, specifically an object that has a -\method{write()} method as described above. With this extended form, -the subsequent expressions are printed to this file object. If the -first expression evaluates to \code{None}, then \code{sys.stdout} is -used as the file for output. - - \section{The \keyword{return} statement \label{return}} \stindex{return} |