Remove trailing whitespace.
diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst
index 1d9b42d..cfa831e 100644
--- a/Doc/howto/functional.rst
+++ b/Doc/howto/functional.rst
@@ -145,7 +145,7 @@
functions are also easier to read and to check for errors.
-Ease of debugging and testing
+Ease of debugging and testing
-----------------------------
Testing and debugging a functional-style program is easier.
@@ -213,7 +213,7 @@
Traceback (most recent call last):
File "<stdin>", line 1, in ?
StopIteration
- >>>
+ >>>
Python expects iterable objects in several different contexts, the most
important being the ``for`` statement. In the statement ``for X in Y``, Y must
@@ -363,7 +363,7 @@
comprehensions are surrounded by square brackets ("[]"). Generator expressions
have the form::
- ( expression for expr in sequence1
+ ( expression for expr in sequence1
if condition1
for expr2 in sequence2
if condition2
@@ -405,7 +405,7 @@
if not (conditionN):
continue # Skip this element
- # Output the value of
+ # Output the value of
# the expression.
This means that when there are multiple ``for...in`` clauses but no ``if``
@@ -419,8 +419,8 @@
>>> seq1 = 'abc'
>>> seq2 = (1,2,3)
>>> [(x,y) for x in seq1 for y in seq2]
- [('a', 1), ('a', 2), ('a', 3),
- ('b', 1), ('b', 2), ('b', 3),
+ [('a', 1), ('a', 2), ('a', 3),
+ ('b', 1), ('b', 2), ('b', 3),
('c', 1), ('c', 2), ('c', 3)]
To avoid introducing an ambiguity into Python's grammar, if ``expression`` is
@@ -627,7 +627,7 @@
Two of Python's built-in functions, :func:`map` and :func:`filter` duplicate the
features of generator expressions:
-``map(f, iterA, iterB, ...)`` returns an iterator over the sequence
+``map(f, iterA, iterB, ...)`` returns an iterator over the sequence
``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``.
>>> def upper(s):
@@ -639,7 +639,7 @@
>>> [upper(s) for s in ['sentence', 'fragment']]
['SENTENCE', 'FRAGMENT']
-You can of course achieve the same effect with a list comprehension.
+You can of course achieve the same effect with a list comprehension.
``filter(predicate, iter)`` returns an iterator over all the sequence elements
that meet a certain condition, and is similarly duplicated by list
@@ -709,7 +709,7 @@
True
>>> all([0,1,0])
False
- >>> all([0,0,0])
+ >>> all([0,0,0])
False
>>> all([1,1,1])
True
@@ -827,7 +827,7 @@
``itertools.starmap(func, iter)`` assumes that the iterable will return a stream
of tuples, and calls ``f()`` using these tuples as the arguments::
- itertools.starmap(os.path.join,
+ itertools.starmap(os.path.join,
[('/usr', 'bin', 'java'), ('/bin', 'python'),
('/usr', 'bin', 'perl'),('/usr', 'bin', 'ruby')])
=>
@@ -887,9 +887,9 @@
::
- city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),
+ city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),
('Anchorage', 'AK'), ('Nome', 'AK'),
- ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ'),
+ ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ'),
...
]
@@ -904,7 +904,7 @@
where
iterator-1 =>
('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL')
- iterator-2 =>
+ iterator-2 =>
('Anchorage', 'AK'), ('Nome', 'AK')
iterator-3 =>
('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')
@@ -1045,7 +1045,7 @@
>>> double(add(5, 6))
22
-
+
The ``unpack`` keyword is provided to work around the fact that Python functions
are not always `fully curried <http://en.wikipedia.org/wiki/Currying>`__. By
default, it is expected that the ``inner`` function will return a single object
@@ -1054,15 +1054,15 @@
will be expanded before being passed to ``outer``. Put simply, ::
compose(f, g)(5, 6)
-
+
is equivalent to::
f(g(5, 6))
-
+
while ::
compose(f, g, unpack=True)(5, 6)
-
+
is equivalent to::
f(*g(5, 6))
@@ -1074,21 +1074,21 @@
from functional import compose, partial
import functools
-
+
multi_compose = partial(functools.reduce, compose)
-
-
+
+
We can also use ``map()``, ``compose()`` and ``partial()`` to craft a version of
``"".join(...)`` that converts its arguments to string::
from functional import compose, partial
-
+
join = compose("".join, partial(map, str))
``flip(func)``
-
+
``flip()`` wraps the callable in ``func`` and causes it to receive its
non-keyword arguments in reverse order. ::
@@ -1103,7 +1103,7 @@
(7, 6, 5)
``foldl(func, start, iterable)``
-
+
``foldl()`` takes a binary function, a starting value (usually some kind of
'zero'), and an iterable. The function is applied to the starting value and the
first element of the list, then the result of that and the second element of the
@@ -1117,7 +1117,7 @@
f(f(f(0, 1), 2), 3)
-
+
``foldl()`` is roughly equivalent to the following recursive function::
def foldl(func, start, seq):
@@ -1224,7 +1224,7 @@
4) Convert the lambda to a def statement, using that name.
5) Remove the comment.
-I really like these rules, but you're free to disagree
+I really like these rules, but you're free to disagree
about whether this lambda-free style is better.
@@ -1282,7 +1282,7 @@
Text Processing".
Mertz also wrote a 3-part series of articles on functional programming
-for IBM's DeveloperWorks site; see
+for IBM's DeveloperWorks site; see
`part 1 <http://www-128.ibm.com/developerworks/library/l-prog.html>`__,
`part 2 <http://www-128.ibm.com/developerworks/library/l-prog2.html>`__, and
`part 3 <http://www-128.ibm.com/developerworks/linux/library/l-prog3.html>`__,