Skip to content

Commit 8a28a13

Browse files
committed
Fixup
1 parent bc69106 commit 8a28a13

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

doc/source/heritage.rst

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ Heritage
22
========
33

44
While Python was originally intended as an imperative language
5-
[Guido_], it contains all elements necessary to support a rich set of features
5+
[`Guido`_], it contains all elements necessary to support a rich set of features
66
from the functional paradigm. In particular its core data structures, lazy
77
iterators, and functions as first class objects can be combined to implement a
88
common standard library of functions shared among many functional languages.
99

1010
This was first recognized and supported through the standard libraries
11-
itertools_ and functools_ which contain functions like ``permutations``,
11+
itertools_ and `functools`_ which contain functions like ``permutations``,
1212
``chain`` and ``partial`` to complement the standard ``map``, ``filter``,
1313
``reduce`` already found in the core language. While these libraries contain
1414
substantial functionality they do not achieve the same level of adoption found
@@ -17,35 +17,31 @@ incomplete and lack a number of commonly related functions like ``compose`` and
1717
``groupby`` which often complement these core operations.
1818

1919
A completion of this set of functions was first attempted in the projects
20-
itertoolz_ and functoolz_ (note the z). These libraries contained
21-
several functions that were absent in the standard itertools_/functools_
20+
`itertoolz`_ and `functoolz`_ (note the z). These libraries contained
21+
several functions that were absent in the standard itertools_ / `functools`_
2222
libraries. The ``itertoolz``/``functoolz`` libraries were eventually merged
2323
into the monolithic ``toolz`` project described here.
2424

2525
Most contemporary functional languages (Haskell, Scala, Clojure, ...) contain
2626
some variation of the functions found in ``toolz``. The ``toolz`` project
2727
generally adheres closely to the API found in the Clojure standard library (see
28-
cheatsheet_) and where disagreements occur that API usually dominates. The
28+
`cheatsheet`_) and where disagreements occur that API usually dominates. The
2929
``toolz`` API is also strongly affected by the principles of the Python
3030
language itself, and often makes deviations in order to be more approachable to
3131
that community.
3232

3333
The development of a functional standard library within a popular imperative
3434
language is not unique. Similar projects have arisen in other
3535
imperative-by-design languages that contain the necessary elements to support a
36-
functional standard library. Underscore.js_ in JavaScript has attained
36+
functional standard library. `Underscore.js <https://underscorejs.org>`_ in JavaScript has attained
3737
notable popularity in the web community. ``LINQ`` in C# follows a similar
3838
philosophy but mimics declarative database languages rather than functional
39-
ones. Enumerable_ is is the closest project in Ruby. Other excellent projects
40-
also exist within the Python ecosystem, most notably Fn.py_ and Funcy_.
39+
ones. `Enumerable <https://ruby-doc.org/core-2.0.0/Enumerable.html>`_ is is the closest project in Ruby. Other excellent projects
40+
also exist within the Python ecosystem, most notably `Fn.py <https://github.com/kachayev/fn.py>`_ and `Funcy <https://github.com/suor/funcy/>`_.
4141

42-
.. [itertools] https://docs.python.org/2/library/itertools.html
43-
.. [functools] https://docs.python.org/2/library/functools.html
44-
.. [itertoolz] https://github.com/mrocklin/itertoolz
45-
.. [functoolz] https://github.com/mrocklin/functoolz
46-
.. [Underscore.js] https://underscorejs.org
47-
.. [cheatsheet] https://clojure.org/cheatsheet
48-
.. [Guido] https://python-history.blogspot.com/2009/04/origins-of-pythons-functional-features.html
49-
.. [Enumerable] https://ruby-doc.org/core-2.0.0/Enumerable.html
50-
.. [funcy] https://github.com/suor/funcy/
51-
.. [fn.py] https://github.com/kachayev/fn.py
42+
.. _itertools: https://docs.python.org/library/itertools.html
43+
.. _functools: https://docs.python.org/library/functools.html
44+
.. _itertoolz: https://github.com/mrocklin/itertoolz
45+
.. _functoolz: https://github.com/mrocklin/functoolz
46+
.. _cheatsheet: https://clojure.org/cheatsheet
47+
.. _Guido: https://python-history.blogspot.com/2009/04/origins-of-pythons-functional-features.html

doc/source/laziness.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ memory. They act like lists but don't take up space.
99
Example - A Tale of Two Cities
1010
------------------------------
1111

12-
We open a file containing the text of the classic text "A Tale of Two Cities"
13-
by Charles Dickens[1_].
12+
We open `a file <http://www.gutenberg.org/cache/epub/98/pg98.txt>`_ containing
13+
the text of the classic text "A Tale of Two Cities"
14+
by Charles Dickens.
1415

1516
.. code::
1617
@@ -98,6 +99,4 @@ In this case ``frequencies`` is a sort of reduction. At no time were more than
9899
a few hundred bytes of Tale of Two Cities necessarily in memory. We could just
99100
have easily done this computation on the entire Gutenberg collection or on
100101
Wikipedia. In this case we are limited by the size and speed of our hard drive
101-
and not by the capacity of our memory.
102-
103-
.. [1] http://www.gutenberg.org/cache/epub/98/pg98.txt
102+
and not by the capacity of our memory.

toolz/itertoolz.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ def join(leftkey, leftseq, rightkey, rightseq,
817817
This is a semi-streaming operation. The LEFT sequence is fully evaluated
818818
and placed into memory. The RIGHT sequence is evaluated lazily and so can
819819
be arbitrarily large.
820+
820821
(Note: If right_default is defined, then unique keys of rightseq
821822
will also be stored in memory.)
822823

toolz/sandbox/parallel.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ def fold(binop, seq, default=no_default, map=map, chunksize=128, combine=None):
1414
"""
1515
Reduce without guarantee of ordered reduction.
1616
17+
Parameters
18+
----------
19+
binops
20+
Associative operator. The associative property allows us to
21+
leverage a parallel map to perform reductions in parallel.
22+
23+
1724
inputs:
1825
1926
``binop`` - associative operator. The associative property allows us to
2027
leverage a parallel map to perform reductions in parallel.
28+
2129
``seq`` - a sequence to be aggregated
2230
``default`` - an identity element like 0 for ``add`` or 1 for mul
2331

0 commit comments

Comments
 (0)