[Python-Dev] [BULK] Python-Dev Digest, Vol 31, Issue 37

Smith smiles at worksmail.net
Thu Feb 9 03:07:59 CET 2006


| From: Michael Hudson <mwh at python.net>
| Guido van Rossum <guido at python.org> writes:
| 
|| On 2/8/06, Patrick Collison <patrick at collison.ie> wrote:
||| And to think that people thought that keeping "lambda", but changing
||| the name, would avoid all the heated discussion... :-)
|| 
|| Note that I'm not participating in any attempts to "improve" lambda.
|| 
|| Just about the only improvement I'd like to see is to add parentheses
|| around the arguments, so you'd write lambda(x, y): x**y instead of
|| lambda x, y: x**y.
| 
| That would seem to be a bad idea, as it means something already:
| 
|||| f = lambda (x,y): x + y
|||| t = (1,2)
|||| f(t)
| 3
| 
| Cheers,
| mwh

Hey! I didn't know you could do that. I'm happy. My lambdas just grew parenthesis on the arguments:

>>> f=lambda(x):x+1
>>> f(2)
3
>>> def go(f,x):
...  print f(x)
...  
>>> go(lambda(x):x+1,1)
2
>>> go(lambda(x,y):x+y,(1,3))
4
>>> 

/c


More information about the Python-Dev mailing list