Pipe-like built-in functions.
from bpipe import *
data = [1, 2, 3, 4]
sum_ = data | sum()
prod = data | reduce(lambda x, y: x*y)
print(sum_, prod, data | len())
# these still work
print(sum(data), len(data))
- This version overrides builtins and it's not safe. For a safer version see bpipe2.
- You can use both
>>
and|
Inspired by Pipe.