How do I dynamically create functions without lambda?

Robert Kern robert.kern at gmail.com
Fri Jan 27 14:26:38 EST 2006


Russell wrote:
> I want my code to be Python 3000 compliant, and hear
> that lambda is being eliminated. The problem is that I
> want to partially bind an existing function with a value
> "foo" that isn't known until run-time:
> 
>    someobject.newfunc = lambda x: f(foo, x)
> 
> The reason a nested function doesn't work for this is
> that it is, well, dynamic. I don't know how many times
> or with what foo's this will be done.
> 
> Now, I am sure there are a half-dozen ways to do this.
> I just want the one, new and shiny, Pythonic way. ;-)

It doesn't exist, yet. Python 3000 isn't even in planning stages, yet. There are
just some loose ideas floating around about what will (and won't!) be in it.

You can't write Python 3000 compliant code right now because there is nothing to
comply with.

-- 
Robert Kern
robert.kern at gmail.com

"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