Yeah very good points! As long as you designed the functions to be used for the 
pipeline, then we’re fine. However, you might force the programmer to write 
unnecessary functions (almost boil-plate code of switching arguments around) 
based on already existing optimized functions scattered everywhere so they fit 
with the pipeline unless you do them on the fly (lambda function) which has its 
drawbacks as well.

1 -> add(2) -> ((y, x) => pow(x, y))(3) 
 is way less readable than 
1 -> add(2) -> pow(3, _) 
 The above is just an example. It could be written better using operators 3 ** 
(1 + 2) 

Abdulla 
Sent from my iPhone

> On 2 Dec 2021, at 12:42 PM, Stephen J. Turnbull <stephenjturnb...@gmail.com> 
> wrote:
> 
> Abdulla Al Kathiri writes:
> 
>> Thanks for the clarification. Yeah I agree it will look ugly if we
>> use it not as a first argument many times in a row but what if
>> there is one or two functions in the middle that they are not
>> playing along and don’t have teamwork ethics,
> 
> Function definitions or lambdas are cheap.
> 
>> 1 -> add(2) -> pow(3, _) equivalent to 1 -> add(_, 2) -> pow(3, _).
>> _ is where your output goes into. _ as a first argument can be omitted.
> 
> def rpow(x, y): return pow(y, x)
> 1 -> add(2) -> rpow(3)
> 
> But in many cases it won't be necessary because you will be defining
> functions for the pipeline, rather than fitting the pipeline to
> preexisting functions.
> 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/TBSB3BLLYXG7XZ5IXWMMYXP3XGHNPYZ5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to