Re: lambda construction

Kenneth Manheimer (klm@nist.gov)
Mon, 20 Jun 1994 22:36:09 GMT

I'm confused.

In article <guido@voorn.cwi.nl> Guido.van.Rossum@cwi.nl writes:
> > def wrap (ofunc):
> > return lambda *args: (process_args(args), apply (ofunc, args))[1]
> >
> > The problem is that once I've returned, "ofunc" isn't bound. So how to
> > write this? If I knew the number of arguments, I'd write
>
> Actually, ofunc is *never* bound inside that lambda! If you were to
> call it inside wrap it would also fail. Python is not Lisp! It has

I take that to mean the following (actual python interactions) should
not happen:

>>> def wrap(ofunc):
... return ofunc('hello from wrap... ')
...
>>> def enwrapt(argh):
... return argh + 'goodbye from enwrapt'
...
>>> wrap(enwrapt)
'hello from wrap... goodbye from enwrapt'
>>>

I suspect i'm being dense. Where am i going astray?

Ken
ken.manheimer@nist.gov, 301 975-3539