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

Stephan Houben stephanh42 at gmail.com
Sat Feb 18 05:00:14 EST 2017


Hi Erik,

I have changed my proposal to the alternative syntax
 a:: b
(Note my preferred spacing.
This is to make it read like some annoation applied to the expression,
like
   delayed:: expensive_function()+1
)

Since :: is a binary operator, we need to think about
associativity.

My conservative proposal would be to make it non-associative,
you would have to write explicitly
  a:: (b:: c)
or
 (a:: b):: c

Stephan

Op 17 feb. 2017 22:35 schreef "Erik" <python at lucidity.plus.com>:

On 17/02/17 10:22, Stephan Houben wrote:

> Proposal: Light-weight call-by-name syntax in Python
>
>   The following syntax
>      a : b
>   is to be interpreted as:
>      a(lambda: b)
>

Isn't this too general a syntax? Doesn't it lead to something like:

if a: b: c: d: e: pass

E.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170218/5ccf9cad/attachment.html>


More information about the Python-ideas mailing list