How Pipe infix syntax works
mainPipe enables a shell-like infix syntax in Python using the | operator. This allows you to chain operations on iterables in a readable, linear fashion.
Each pipe is lazily evaluated, can be aliased (pre-configured with arguments), and can be partially initialized. This makes it ideal for building complex data processing pipelines.
Example of aliasing a pipe:
is_even = where(lambda x: x % 2 == 0)
sum(fib() | is_even | take_while(lambda x: x < 4000000))sum(fib() | where(lambda x: x % 2 == 0) | take_while(lambda x: x < 4000000))