Operators
This page is the complete catalog of pipescript’s pipe and composition operators. For a gentler introduction see Your first pipeline and Use the other pipe operators.
Forward pipe operators
The table below lists every forward pipe operator and the vanilla Python it corresponds to.
Operator |
pipescript syntax |
Python equivalent |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Families at a glance:
Apply (
|>) – call the function with the piped value.Assign (
|>>) – write the value to a name, then keep flowing it.Unpack prefixes –
*spreads an iterable as positional args,**spreads a dict as keyword args.Compose (
.>) – combine two functions instead of applying them; the left-hand function runs first.Optional (
?>) – short-circuit toNonewhen the input isNone.Partial (
$>) – build afunctools.partial()rather than calling.
Backward operators
Every operator except |>> has a backward variant that swaps which side is
the value and which is the function. <| is the backward form of |> (a
low-precedence apply):
>>> reversed .> list <| [1, 2, 3]
[3, 2, 1]
Composition power (.**)
.** composes a single-argument function with itself a given number of times,
so f .** n is f applied n times:
>>> 42 |> collatz .** 20 # 42 |> collatz |> collatz |> ... (20 times)
Precedence and associativity
All pipe operators are left-associative and share the precedence of |
(bitwise or). Steps run strictly left to right in the order they appear
(including backward pipes). One practical consequence: any pipeline stage that
itself contains a bare | must be parenthesized so it is not parsed as another
pipe boundary.