[Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.31,1.32
Skip Montanaro
python-dev@python.org
Sat, 12 Aug 2000 11:09:53 -0700
Update of /cvsroot/python/python/dist/src/Doc/ref
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9983/Doc/ref
Modified Files:
ref5.tex
Log Message:
list comprehensions. see
http://sourceforge.net/patch/?func=detailpatch&patch_id=100654&group_id=5470
for details.
Index: ref5.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** ref5.tex 2000/07/31 20:08:23 1.31
--- ref5.tex 2000/08/12 18:09:50 1.32
***************
*** 153,163 ****
\begin{verbatim}
! list_display: "[" [expression_list] "]"
\end{verbatim}
! A list display yields a new list object. If it has no expression
! list, the list object has no items. Otherwise, the elements of the
! expression list are evaluated from left to right and inserted in the
! list object in that order.
\obindex{list}
\indexii{empty}{list}
--- 153,172 ----
\begin{verbatim}
! list_display: "[" [expression_list [list_iter]] "]"
! list_iter: list_for | list_if
! list_for: "for" expression_list "in" testlist [list_iter]
! list_if: "if" test [list_iter]
\end{verbatim}
! A list display yields a new list object. Its contents are specified
! by providing either a list of expressions or a list comprehension.
! When a comma-separated list of expressions is supplied, its elements are
! evaluated from left to right and placed into the list object in that
! order. When a list comprehension is supplied, it consists of a
! single expression followed by one or more "for" or "if" clauses. In this
! case, the elements of the new list are those that would be produced
! by considering each of the "for" or "if" clauses a block, nesting from
! left to right, and evaluating the expression to produce a list element
! each time the innermost block is reached.
\obindex{list}
\indexii{empty}{list}