On Fri, Jan 27, 2017 at 3:28 PM, Ethan Furman <et...@stoneleaf.us> wrote:

> On 01/27/2017 01:07 PM, Brent Brinkley wrote:
>
>> Suggested structure:
>>
>>   print() <| some_func() <| another_func("Hello")
>>
>
> My first question is what does this look like when print() and some_func()
> have other parameters?  In other words, what would this look like?
>
>     print('hello', name, some_func('whatsit', another_func('good-bye')),
> sep=' .-. ')


The Elixir pipe operator looks pretty close to the suggested style, but the
argument order is reversed:

another_func('good-bye') |> some_func('whatsit') |> print('hello', name,
sep=' .-. ')

This isn't exactly equivalent to the example though because the result of
each call is passed as the first argument to the next function. I think it
looks nice when it's the right fit, but it's limited to the first argument.

-- 

C Anthony
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to