what is lambda used for in real code?

Steve Holden steve at holdenweb.com
Sat Jan 1 15:01:01 EST 2005


Alex Martelli wrote:

> Steve Holden <steve at holdenweb.com> wrote:
> 
> 
>>Adam DePrince wrote:
>>[...]
>>
>>>In sort, we must preserve the ability to create an anonymous function
>>>simply because we can do so for every other object type, and functions
>>>are not special enough to permit this special case.
>>>
>>
>>And you'd create an anonymous type how, exactly?
> 
> 
>>>>type('',(),{})
> 
> <class '__main__.'>
> 
> maybe...?
> 
> 
Indeed. And then you'd insert all the methods as lambdas by ....

We both know that the Python language framework has enough introspection 
capabilities to do this, but I'm pretty sure you wouldn't try to pretend 
that this would represent a realistic programming style. Or am I wrong?

regards
  Steve
-- 
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119



More information about the Python-list mailing list