summaryrefslogtreecommitdiff
path: root/Doc/tutorial/datastructures.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-01-03 20:55:06 +0000
committerGeorg Brandl <georg@python.org>2009-01-03 20:55:06 +0000
commitc62ef8b4d9648c36218cb0142a6395a00c11885e (patch)
tree74d90ea6215a37553bb1cddfc4c4eddf947958e9 /Doc/tutorial/datastructures.rst
parente92818f58c134549c8820073037a1655330bbea1 (diff)
downloadcpython-git-c62ef8b4d9648c36218cb0142a6395a00c11885e.tar.gz
Remove trailing whitespace.
Diffstat (limited to 'Doc/tutorial/datastructures.rst')
-rw-r--r--Doc/tutorial/datastructures.rst12
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index fa71870249..f7e7243d74 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -214,7 +214,7 @@ and the next item, and so on. For example, ::
>>> def sum(seq):
... def add(x,y): return x+y
... return reduce(add, seq, 0)
- ...
+ ...
>>> sum(range(1, 11))
55
>>> sum([])
@@ -281,7 +281,7 @@ If you've got the stomach for it, list comprehensions can be nested. They are a
powerful tool but -- like all powerful tools -- they need to be used carefully,
if at all.
-Consider the following example of a 3x3 matrix held as a list containing three
+Consider the following example of a 3x3 matrix held as a list containing three
lists, one list per row::
>>> mat = [
@@ -290,7 +290,7 @@ lists, one list per row::
... [7, 8, 9],
... ]
-Now, if you wanted to swap rows and columns, you could use a list
+Now, if you wanted to swap rows and columns, you could use a list
comprehension::
>>> print [[row[i] for row in mat] for i in [0, 1, 2]]
@@ -308,7 +308,7 @@ A more verbose version of this snippet shows the flow explicitly::
print row[i],
print
-In real world, you should prefer builtin functions to complex flow statements.
+In real world, you should prefer builtin functions to complex flow statements.
The :func:`zip` function would do a great job for this use case::
>>> zip(*mat)
@@ -551,7 +551,7 @@ with the :func:`zip` function. ::
>>> answers = ['lancelot', 'the holy grail', 'blue']
>>> for q, a in zip(questions, answers):
... print 'What is your {0}? It is {1}.'.format(q, a)
- ...
+ ...
What is your name? It is lancelot.
What is your quest? It is the holy grail.
What is your favorite color? It is blue.
@@ -574,7 +574,7 @@ returns a new sorted list while leaving the source unaltered. ::
>>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana']
>>> for f in sorted(set(basket)):
... print f
- ...
+ ...
apple
banana
orange