@@ -215,9 +215,44 @@ \section{PEP 278: Universal Newline Support}
215215
216216\end {seealso }
217217
218+
218219% ======================================================================
219- \section {PEP 285: The \class {bool} Type\label {section-bool } }
220+ \section {PEP 279: The \function {enumerate()} Built-in Function }
221+
222+ A new built-in function, \function {enumerate()}, will make
223+ certain loops a bit clearer. \code {enumerate(thing)}, where
224+ \var {thing} is either an iterator or a sequence, returns a iterator
225+ that will return \code {(0, \var {thing[0]})}, \code {(1,
226+ \var {thing[1]})}, \code {(2, \var {thing[2]})}, and so forth. Fairly
227+ often you'll see code to change every element of a list that looks
228+ like this:
229+
230+ \begin {verbatim }
231+ for i in range(len(L)):
232+ item = L[i]
233+ # ... compute some result based on item ...
234+ L[i] = result
235+ \end {verbatim }
220236
237+ This can be rewritten using \function {enumerate()} as:
238+
239+ \begin {verbatim }
240+ for i, item in enumerate(L):
241+ # ... compute some result based on item ...
242+ L[i] = result
243+ \end {verbatim }
244+
245+
246+ \begin {seealso }
247+
248+ \seepep {279}{The enumerate() built-in function}{Written
249+ by Raymond D. Hettinger.}
250+
251+ \end {seealso }
252+
253+
254+ % ======================================================================
255+ \section {PEP 285: The \class {bool} Type\label {section-bool } }
221256
222257A Boolean type was added to Python 2.3. Two new constants were added
223258to the \module {__builtin__} module, \constant {True} and
@@ -292,41 +327,20 @@ \section{PEP 285: The \class{bool} Type\label{section-bool}}
292327
293328
294329% ======================================================================
295- \section {Other Language Changes }
296-
297- Here are the changes that Python 2.3 makes to the core language.
298-
299- \begin {itemize }
300- \item The \keyword {yield} statement is now always a keyword, as
301- described in section~\ref {section-generators }.
302-
303- \item Two new constants, \constant {True} and \constant {False} were
304- added along with the built-in \class {bool} type, as described in
305- section~\ref {section-bool }.
306-
307- \item A new built-in function, \function {enumerate()}, will make
308- certain loops a bit clearer. \code {enumerate(thing)}, where
309- \var {thing} is either an iterator or a sequence, returns a iterator
310- that will return \code {(0, \var {thing[0]})}, \code {(1,
311- \var {thing[1]})}, \code {(2, \var {thing[2]})}, and so forth. Fairly
312- often you'll see code to change every element of a list that looks like this:
330+ % \section{Other Language Changes}
313331
314- \begin {verbatim }
315- for i in range(len(L)):
316- item = L[i]
317- # ... compute some result based on item ...
318- L[i] = result
319- \end {verbatim }
332+ % Here are the changes that Python 2.3 makes to the core language.
320333
321- This can be rewritten using \function {enumerate()} as:
334+ % \begin{itemize}
335+ % \item The \keyword{yield} statement is now always a keyword, as
336+ % described in section~\ref{section-generators}.
322337
323- \begin {verbatim }
324- for i, item in enumerate(L):
325- # ... compute some result based on item ...
326- L[i] = result
327- \end {verbatim }
338+ % \item Two new constants, \constant{True} and \constant{False} were
339+ % added along with the built-in \class{bool} type, as described in
340+ % section~\ref{section-bool}.
328341
329- \end {itemize }
342+ % \item
343+ % \end{itemize}
330344
331345
332346% ======================================================================
@@ -386,7 +400,7 @@ \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}}
386400
387401\begin {seealso }
388402
389- \seeurl {XXX }
403+ \seeurl {http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Objects/obmalloc.c }
390404{For the full details of the pymalloc implementation, see
391405the comments at the top of the file \file {Objects/obmalloc.c} in the
392406Python source code. The above link points to the file within the
@@ -491,7 +505,7 @@ \section{New and Improved Modules}
491505characters using the \samp {u} format character. Arrays also
492506now support using the \code {+=} assignment operator to add another array's
493507contents, and the \code {*=} assignment operator to repeat an array.
494- (Contributed by XXX .)
508+ (Contributed by Jason Orendorff .)
495509
496510\item The \module {grp} module now returns enhanced tuples:
497511
@@ -518,8 +532,8 @@ \section{Build and C API Changes}
518532
519533\item Python can now optionally be built as a shared library
520534(\file {libpython2.3.so}) by supplying \longprogramopt {enable-shared}
521- when running Python's \file {configure} script. (Contributed by XXX
522- Patch \# 527027 )
535+ when running Python's \file {configure} script. (Contributed by Ondrej
536+ Palkovsky. )
523537
524538\item The \cfunction {PyArg_NoArgs()} macro is now deprecated, and code
525539that
0 commit comments