[Python-checkins] python/dist/src/Doc/tut tut.tex,1.201,1.202
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Sat Aug 30 17:21:34 EDT 2003
Update of /cvsroot/python/python/dist/src/Doc/tut
In directory sc8-pr-cvs1:/tmp/cvs-serv936
Modified Files:
tut.tex
Log Message:
SF patch #797868: Tutorial, sec. 5.1.4 could contain an extra example
(Revised from the original patch contributed by Michal Pasternak.)
Also, make a couple minor fixups elsewhere.
Index: tut.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v
retrieving revision 1.201
retrieving revision 1.202
diff -C2 -d -r1.201 -r1.202
*** tut.tex 23 Aug 2003 03:49:08 -0000 1.201
--- tut.tex 30 Aug 2003 23:21:32 -0000 1.202
***************
*** 123,127 ****
single statement;
\item
! statement grouping is done by indentation instead of begin/end
brackets;
\item
--- 123,127 ----
single statement;
\item
! statement grouping is done by indentation instead of beginning and ending
brackets;
\item
***************
*** 518,522 ****
Traceback (most recent call last):
File "<stdin>", line 1, in ?
! TypeError: can't convert complex to float; use e.g. abs(z)
>>> a.real
3.0
--- 518,522 ----
Traceback (most recent call last):
File "<stdin>", line 1, in ?
! TypeError: can't convert complex to float; use abs(z)
>>> a.real
3.0
***************
*** 1924,1927 ****
--- 1924,1935 ----
>>> [vec1[i]*vec2[i] for i in range(len(vec1))]
[8, 12, -54]
+ \end{verbatim}
+
+ List comprehensions are much more flexible than \function{map()} and can be
+ applied to functions with more than one argument and to nested functions:
+
+ \begin{verbatim}
+ >>> [str(round(355/113.0, i)) for i in range(1,6)]
+ ['3.1', '3.14', '3.142', '3.1416', '3.14159']
\end{verbatim}
More information about the Python-checkins
mailing list