Creating anonymous functions using eval

Robert Kern rkern at ucsd.edu
Tue Jul 12 16:23:41 EDT 2005


Devan L wrote:
> Well, the string that gets passed is more or less a function
> definition, which is then called with exec. I don't see why you'd need
> to write a string out with the function definition and then call it.
> You could just write the function.
> 
> As for the nested functions, I had been presuming that it was intended
> to use as a better function than lambda within a function. Sorry for
> the confusion.

You missed Steven's point which is to quote the message to which you are 
replying. Not everyone is reading this list in a conveniently threaded 
form, so you need to provide some context for them to be able to follow 
along.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list