0101/pipetools

>> instead of > for input

goingtosleep opened this issue · 1 comments

I don't know if it's possible to change > to >> for the input method? IMO >> is less used, especially in numerical / science-related code. I looked around the source code but didn't find where to make the change (I don't see __gt__ method in Pipe class).

Thank you.

0101 commented

Unfortunately that's not possible because of operator precedence. >> binds stronger than |, so input >> func1 | func2 would be evaluated as (input >> func1) | func2, so you'd have to always put parentheses around the piping composition - and face possibly confusing errors when you forget.

If using > for input is making your code confusing, I recommend naming your composed functions and then just calling them the usual way:

my_func = dothis | dothat | etc
my_func(input)