Partial
Partial function operators allow you to quickly create a new function by binding some parameters. Compared with the standard library functools.partial
, it is more flexible and powerful.
Grammar
1 2 3 4 5 6 7 8 9 |
|
Each ?
means to add a positional parameter to the generated function.
Trick
When you need to pass a sequence, but only want to pass a parameter using a pipe (|>
), please use *?
.
Try to see the difference between ("hello", "world") |> print(?)
and ("hello", "world") |> print(*?)
.