[Python-ideas] Light-weight call-by-name syntax in Python

Stephan Houben stephanh42 at gmail.com
Fri Feb 17 05:46:00 EST 2017


Hi Nathaniel,


2017-02-17 11:28 GMT+01:00 Nathaniel Smith <njs at pobox.com>:
>
> Note that this is definitely a different proposal from the original,
> since the original proposer's goal was to be able to use this with
> existing, unmodified functions that expect a regular value, not a
> lambda.
>
> I don't really see how that goal can be accomplished without massively
> revising Python's runtime model, so this doesn't really bother me, but
> it should be noted :-).
>

Yep  ;-)


>
> Anyway, you might also be interested in:
>
>    https://mail.python.org/pipermail/python-ideas/2016-
> November/043590.html
>
> which is a similar idea and some more motivating examples, except that
> it allows for the full richness of Python's call syntax, and passes
> ASTs rather than lambdas to allow for non-standard evaluation rules.
>
>
Frankly, I think that proposal is too baroque.
The simplicity of my proposal is intentional.
Just passing in a callable makes it simpler and makes it
also more likely that existing functions could be used with it.

I have considered adding all kind of syntax for adding extra arguments
to the wrapped callable, extra arguments for the invoked function, ...
basically that just makes it a mess. If you want that, use the existing
syntax.

By the way,  got a private e-mail mentioning that the proposed syntax is
already claimed by
type annotations. So therefore

   a :: b

is now my proposed syntax.

Stephan



> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170217/08db2556/attachment.html>


More information about the Python-ideas mailing list