summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-12-03 18:54:33 (GMT)
committerFred Drake <fdrake@acm.org>2001-12-03 18:54:33 (GMT)
commit1da50f6c6ead4629df8b4c359f92547447b67324 (patch)
tree922e9526d7bc3b5737d44b1fc95fed53644a1be9
parentf4c20d354c313e34c0de50656bbae62fecb91bcf (diff)
downloadcpython-1da50f6c6ead4629df8b4c359f92547447b67324.zip
cpython-1da50f6c6ead4629df8b4c359f92547447b67324.tar.gz
cpython-1da50f6c6ead4629df8b4c359f92547447b67324.tar.bz2
Add a scalar product to the example list comprehensions based on a suggestion
sent to python-docs.
-rw-r--r--Doc/tut/tut.tex2
1 files changed, 2 insertions, 0 deletions
diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex
index 387b53c..dfa71fe 100644
--- a/Doc/tut/tut.tex
+++ b/Doc/tut/tut.tex
@@ -1846,6 +1846,8 @@ SyntaxError: invalid syntax
[8, 6, -18, 16, 12, -36, 24, 18, -54]
>>> [x+y for x in vec1 for y in vec2]
[6, 5, -7, 8, 7, -5, 10, 9, -3]
+>>> [vec1[i]*vec2[i] for i in range(len(vec1))]
+[8, 12, -54]
\end{verbatim}