3 ms·
Python doesn't have a built-in pipe operator, but that doesn't mean you can't do it. The pipe [1] library is popular. is_even = where(lambda x: x % 2 == 0)
by atombender 3y ago
Python doesn't have a built-in pipe operator, but that doesn't mean you can't do it. The pipe [1] library is popular.
is_even = where(lambda x: x % 2 == 0)
sum(fib() | is_even | take_while(lambda x: x < 4000000)
The Apache Beam SDK for Python is another example. It has its own pipe expressions (|, >>, |>, etc.).
[1] https://github.com/JulienPalard/Pipe https://github.com/JulienPalard/Pipe
- heywhatupboys 3y agoI would haver have + than | if we introduce "custom" operators. Like maybe bitshifting strings into streams wasn't the right syntax, Bjarne