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

2017-02-19 Thread Ed Kellett
On Fri, 17 Feb 2017 at 10:23 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) > > Effectively, this gives a "light-weight macro system" to Python, > since it allows with little syn

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

2017-02-18 Thread Stephan Houben
2017-02-18 11:55 GMT+01:00 Nathaniel Smith : > > This is also potentially a downside, though... the macro-call proposal > not only handles the cases you're worrying about, but also handles a > bunch of cases that are basically impossible to handle in Python right > now. OTOH all the cases where yo

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

2017-02-18 Thread Nathaniel Smith
On Fri, Feb 17, 2017 at 2:46 AM, Stephan Houben wrote: > Hi Nathaniel, > > > 2017-02-17 11:28 GMT+01:00 Nathaniel Smith : >> >> 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 functio

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

2017-02-18 Thread Stephan Houben
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

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

2017-02-17 Thread Erik
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. _

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

2017-02-17 Thread Stephan Houben
Hi Nathaniel, 2017-02-17 11:28 GMT+01:00 Nathaniel Smith : > > 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

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

2017-02-17 Thread Nathaniel Smith
On Fri, Feb 17, 2017 at 2:22 AM, 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) > > Effectively, this gives a "light-weight macro system" to Python, > since it allows with little

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

2017-02-17 Thread Stephan Houben
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 immediat