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

Ed Kellett edk141 at gmail.com
Sun Feb 19 08:03:32 EST 2017

On Fri, 17 Feb 2017 at 10:23 Stephan Houben <stephanh42 at gmail.com> wrote:

> Proposal: Light-weight call-by-name syntax in Python
>   The following syntax
>      a : b
>   is to be interpreted as:
>      a(lambda: b)
> Effectively, this gives a "light-weight macro system" to Python,
> since it allows with little syntax to indicate that the argument to
> a function is not to be immediately invoked.

This is, in my view, one case where Python's existing lambda syntax is
perfectly sufficient. (I'd even argue it might be the *only* case...) If
you could logger.debug(lambda: expensive_to_compute_message_here), I don't
think that the delayed-expression proposal would ever have existed.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170219/cd4c5bf5/attachment-0001.html>

More information about the Python-ideas mailing list