June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,10 @@
>>> from functools import partial
>>> from operator import add
>>> add2 = partial(add, 2)
>>> add2
functools.partial(<built-in function add>, 2)
>>> add2(7)
9
>>> double = partial(map, lambda x: x*2)
>>> print(*double(range(5)))
0 2 4 6 8

View file

@ -0,0 +1,13 @@
>>> from toolz import curry
>>> import operator
>>> add = curry(operator.add)
>>> add2 = add(2)
>>> add2
<built-in function add>
>>> add2(7)
9
>>> # Toolz also has pre-curried versions of most HOFs from builtins, stdlib, and toolz
>>>from toolz.curried import map
>>> double = map(lambda x: x*2)
>>> print(*double(range(5)))
0 2 4 6 8