[Python-Dev] code blocks using 'for' loops and generators

Brian Sabbey sabbey at u.washington.edu
Tue Mar 15 21:41:03 CET 2005

Samuele Pedroni wrote:
> My point is that a suite-based syntax
> can only be a half substitute for lambda and anyway requiring a suite
> seems overkill and unnatural for the just 1 expression case, for example
> predicates. IOW a suite-based syntax is not a lambda killer in itself, I
> would not try to stress that point.

I see your point (also I see Greg Ewing's related point).

> multiple dispatch has nothing to do with syntax, in fact usual call
> syntax is sufficient, and people do use multiple dispatch sometimes,
> and decorators now can be even used to sugar up the definition side
> of it.

But one needs to use decorators or some other mechanism for the sugar, 
that is all I intended the phrase "does not give syntactic support" to 
mean.  Perhaps "syntactic sugar" is the correct term to have used.

>> for something that would be rarely used, I do not think
> well that's up to discussion to discover


> well, but this is stated without even trying to come up with a syntax
> for that case. Notice that the first time around Guido himself would
> have preferred if achievable a multithunk syntax, he obviously can have
> changed his mind. But, yes, syntax vs expressivity is the key issue here.

Ok.  Allow me to try.  Up to a choice of (or existence of!) keywords, the 
simplest to me is:

def add(thunk1, thunk2, other):
 	print thunk1(1,2) + thunk2(3,4) + other

with x,y from add(100):
 	value x*y
also a,b:           # yikes??
 	value a*b   # this is thunk2


More information about the Python-Dev mailing list