[Python-ideas] A more readable way to nest functions

אלעזר elazarg at gmail.com
Sat Jan 28 12:06:30 EST 2017


The title is misleading : it should be "nesting function calls"

Elazar

בתאריך שבת, 28 בינו' 2017, 18:38, מאת Ed Kellett ‏<edk141 at gmail.com>:

> On Sat, 28 Jan 2017 at 14:27 zmo via Python-ideas <python-ideas at python.org>
> wrote:
>
> I agree this would look a bit more elegant. To focus on the feature of
> that operator, instead of how to write it, I'll use XYZ instead of <| in
> this post.
>
>
> My thoughts exactly :)
>
>
> So, considering it's decided that the RHS is in charge of filling up all
> the arguments of the LHS, how to deal with positional and keyword
> arguments without introducing new syntax?
>
>
> My instinct is that we don't need to deal with that; that's what partial
> application is for. To be fair, I'd advocate better syntax for that, but
> it's another issue.
>
>
> anyway, I guess it's pretty safe to assume that if fn_b() returns a
> scalar, it'll be easy to assume it's just a single positional argument.
>
> >     print XYZ some_func XYZ another_func("Hello")
>
> [...]
>
>
>
> Meaning that the above could also be written as:
>
>     print XYZ some_func XYZ another_func XYZ "Hello"
>
>
> That looks good to me, but I think another_func("Hello") is the better one
> to recommend. I think it makes it slightly more obvious what is going on.
>
>
> Then the basic operator definition could be done with a dunder
>
> looking like: [...]
>
>
> I think the special-casiness here is unfortunate and would cause problems.
> a(b()) doesn't randomly pass kwargs to a if b happens to return a certain
> kind of thing.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170128/d1f603d4/attachment.html>


More information about the Python-ideas mailing list