Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57d7128

Browse files
committed
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.
1 parent f9f4c69 commit 57d7128

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Doc/tut/tut.tex

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ \chapter{Whetting Your Appetite \label{intro}}
122122
the high-level data types allow you to express complex operations in a
123123
single statement;
124124
\item
125-
statement grouping is done by indentation instead of begin/end
125+
statement grouping is done by indentation instead of beginning and ending
126126
brackets;
127127
\item
128128
no variable or argument declarations are necessary.
@@ -517,7 +517,7 @@ \subsection{Numbers \label{numbers}}
517517
>>> float(a)
518518
Traceback (most recent call last):
519519
File "<stdin>", line 1, in ?
520-
TypeError: can't convert complex to float; use e.g. abs(z)
520+
TypeError: can't convert complex to float; use abs(z)
521521
>>> a.real
522522
3.0
523523
>>> a.imag
@@ -1925,6 +1925,14 @@ \subsection{List Comprehensions}
19251925
[8, 12, -54]
19261926
\end{verbatim}
19271927

1928+
List comprehensions are much more flexible than \function{map()} and can be
1929+
applied to functions with more than one argument and to nested functions:
1930+
1931+
\begin{verbatim}
1932+
>>> [str(round(355/113.0, i)) for i in range(1,6)]
1933+
['3.1', '3.14', '3.142', '3.1416', '3.14159']
1934+
\end{verbatim}
1935+
19281936
To make list comprehensions match the behavior of \keyword{for}
19291937
loops, assignments to the loop variable remain visible outside
19301938
of the comprehension:

0 commit comments

Comments
 (0)