From 1da50f6c6ead4629df8b4c359f92547447b67324 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Mon, 3 Dec 2001 18:54:33 +0000 Subject: Add a scalar product to the example list comprehensions based on a suggestion sent to python-docs. --- Doc/tut/tut.tex | 2 ++ 1 file changed, 2 insertions(+) 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} -- cgit v0.12