Parameterized Functions without Classes

Oliver Fromme olli at haluter.fromme.com
Fri Jun 25 13:25:24 EDT 2004


Christian Tismer <tismer at stackless.com> 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

-- 
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