Parameterized Functions without Classes

Oliver Fromme olli at
Fri Jun 25 19:25:24 CEST 2004

Christian Tismer <tismer at> wrote:
 > just as a small comment on the side-effects of the
 > rather new concept of local functions with access to
 > their scope:
 > [...]
 > def _converter(scale):
 >     def convert(arg):
 >         return scale * arg
 >     return convert

In what way is that different from using an ordinary lambda
function?  i.e.:

def _converter(scale):
    return lambda arg: scale * arg

Of course, the use of lambda functions is very limited
because (unfortunately) they can contain only one single
expression.  But other than that, it's pretty much the
same concept, isn't it?

Best regards

Oliver Fromme, Konrad-Celtis-Str. 72, 81369 Munich, Germany

``All that we see or seem is just a dream within a dream.''
(E. A. Poe)

More information about the Python-list mailing list