[Python-3000] Requiring () around lambda's argument list

Raymond Hettinger rhettinger at ewtllc.com
Mon May 1 23:09:31 CEST 2006


Guido van Rossum wrote:

>I'm running into something that may make me require parentheses around
>lambda's argument list. 
>

Are the parens always needed or will it depend on the surrounding 
tokens?  Adding extra parens feels a bit odd in the following situations:

    databases = filter(lambda name: name.startswith('2006'), 
cursor.fetchall())
    mylist.sort(key = lambda record:  record.name.lower())


Raymond
   


More information about the Python-3000 mailing list