From: Fred Drake Date: Thu, 12 Feb 2004 14:34:42 +0000 (+0000) Subject: fix minor markup error: \code{for} --> \keyword{for} X-Git-Tag: v2.3.4c1~128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d7a4da4e44b17f7d7cf106b024c5fe1fe17566f6;p=thirdparty%2FPython%2Fcpython.git fix minor markup error: \code{for} --> \keyword{for} --- diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex index f31d6a9abb63..eead6d7bada3 100644 --- a/Doc/tut/tut.tex +++ b/Doc/tut/tut.tex @@ -4220,7 +4220,7 @@ finally the instance converted to a string using the built-in function \section{Iterators\label{iterators}} By now, you've probably noticed that most container objects can be looped -over using a \code{for} statement: +over using a \keyword{for} statement: \begin{verbatim} for element in [1, 2, 3]: @@ -4236,11 +4236,12 @@ for line in open("myfile.txt"): \end{verbatim} This style of access is clear, concise, and convenient. The use of iterators -pervades and unifies Python. Behind the scenes, the \code{for} statement calls -\function{iter()} on the container object. The function returns an iterator -object that defines the method \method{next()} which accesses elements in the -container one at a time. When there are no more elements, \method{next()} -raises a \exception{StopIteration} exception which tells the \code{for} loop +pervades and unifies Python. Behind the scenes, the \keyword{for} +statement calls \function{iter()} on the container object. The +function returns an iterator object that defines the method +\method{next()} which accesses elements in the container one at a +time. When there are no more elements, \method{next()} raises a +\exception{StopIteration} exception which tells the \keyword{for} loop to terminate. This example shows how it all works: \begin{verbatim}