Securing a future for anonymous functions in Python

Roy Smith roy at panix.com
Thu Dec 30 14:24:46 EST 2004


Ian Bicking <ianb at colorstudy.com> wrote:
> I think this specific use case -- defining callbacks -- should be 
> addressed, rather than proposing a solution to something that isn't 
> necessary.  Which is to say, no one *needs* anonymous functions; people 
> may need things which anonymous functions provide, but maybe there's 
> other ways to provide the same thing.  Decorator abuse, for instance ;)

I'm not a big functional programming fan, so it should not come as a 
surprise that I don't often use lambda.  The one place I do use it is in 
unit tests, where assertRaises() requires a callable.  If what you're 
testing is an expression, you need to wrap it in a lambda.

I suppose you could call this a special case of a callback.



More information about the Python-list mailing list