How to create functors?

Terry Reedy tjreedy at
Wed Aug 19 12:48:13 CEST 2009

Robert Dailey wrote:

> I'm using Python 2.6. And using the legacy syntax in the lambda does
> not work either. I want to avoid using a def if possible. Thanks.

In Python, writing

name = lambda arg: expr

instead of

def name(arg): return expr

is all negative and no positive and should be avoided.

Your experience illustrates one reason why.


More information about the Python-list mailing list