PEP 312 - Making lambdas implicit worries me, surely it's just the name 'lambda' that is bad...

Alexander Schmolck a.schmolck at gmx.net
Mon Mar 3 10:10:20 EST 2003


Erik Max Francis <max at alcyone.com> writes:

> Well, Python isn't Smalltalk, so I don't really know where this gets us.

Geez, I don't know either how looking at a language Z (different from python)
that has and makes extensive use of feature X could *possibly* be helpful for
understanding how (some variant of X) might be useful in python. I thought I
just mention it anyway.

> 
> > If ``[x]`` became ``lambda : x``, it would be completely unusable.
> 
> It would become longer, how is that unusable?

Do you think adding a few keystrokes by replacing

 >>> a + b * c[2]   

with the more explict

 >>> a operatorAddOrMaybeConcatenate (b operatorMultiplyOrMaybeRepeat  c 
 ...                                    operatorAtIndexOrMaybeKey 1)

would make python unusable? Or maybe just unpopular? 

(Hint: in case the point of how mere "differences in keystrokes" can widely
affect design choices in a language and its libraries was lost on you; do you
really think anyone would dream of introducing a ternary operator if you could
just do

 def when(cond, a,b):
     if cond: return a()
     else: return  b()

 res = when(cond, :b, :c)

instead of


 res = when(cond, lambda : b, lambda :c)

?)

alex





More information about the Python-list mailing list