[Python-Dev] Recommend accepting PEP 312 -- Simple Implicit Lambda

Jim Jewett jimjjewett at gmail.com
Mon Jun 20 19:42:09 CEST 2005


>>>                lambda x,y: x+y*y
>>>                lambda x,y: y**2+x

>>> are essentialy the same functions with different implementations [1].

>> Except that they are not. Think of __pow__, think of __add__ and __radd__.

> You know the difference between the concept of a function and it's 
> infinitely many representations? That's why formal definitions exist.

To clear up the archives, the problem is that Kay and Reinhold were 
talking about different things when they said "function".  

In arithmetic (and most sane extensions), those two lines are 
essentially the same function written different ways.

In python those two lines represent two different functions, because 
x and y might not be (bound to) sane numbers.  The variables could
be bound to objects that redefine the addition, multiplication, and 
exponentiation operators.  So y*y might not be the same as y**2, 
and x+y might not be the same as y+x.  

-jJ


More information about the Python-Dev mailing list