Special keyword argument lambda syntax
Rhodri James
rhodri at wildebst.demon.co.uk
Sat Mar 14 19:48:42 EDT 2009
On Fri, 13 Mar 2009 15:33:26 -0000, MRAB <google at mrabarnett.plus.com>
wrote:
> Rhodri James wrote:
>> On Fri, 13 Mar 2009 14:49:17 -0000, Beni Cherniavsky
>> <beni.cherniavsky at gmail.com> wrote:
>>
>>> Specification
>>> =============
>>>
>>> Allow keyword arguments in function call to take this form:
>>>
>>> NAME ( ARGUMENTS ) = EXPRESSION
>>>
>>> which is equivallent to the following:
>>>
>>> NAME = lambda ARGUMENTS: EXPRESSION
>>>
>>> except that NAME is also assigned as the function's `__name__`.
>> My first instinct on seeing the example was that "key(n)" was a
>> function *call*, not a function definition, and to remember the thread
>> a month or two ago about assigning to the result of a function call.
>> I'm inclined to think this would add confusion rather than remove it.
>>
> Guido wants to keep the syntax LL(1), so you're not the only one who has
> a problem with it! :-)
>
> I think that:
>
> def NAME ( ARGUMENTS ): EXPRESSION
>
> is still LL(1).
Yes, but at this point we're arguing about how to spell "lambda", and
Python's already got one perfectly good way of spelling it.
--
Rhodri James *-* Wildebeeste Herder to the Masses
More information about the Python-list
mailing list