Pipe-like built-in functions.
from bpipe2 import *
data = [1, 2, 3, 4]
sum_ = data | Sum()
prod = data | Reduce(lambda x, y: x*y)
print(sum_, prod, data | Len())
- This version does not override builtins but you have use
Map()
insteaf ofmap()
(for example). bpipe overrides builtins but it's less safe. - You can use both
>>
and|
Inspired by Pipe.