Miles wrote: > On Fri, Aug 8, 2008 at 2:31 AM, Stefan Behnel wrote: >> I recently had the reverse case that a (stupidly implemented) extension >> module >> required a callback function and I wanted to pass a function wrapped in a >> wrapper object. That failed, because it specifically checked for the argument >> being a function, not just a callable object. I had to pull quite a number of >> tricks to reimplement the wrapper class as a function (thank god, it's >> Python!). > > You really only needed one trick: > > def functionize(callable): > return lambda *args, **kwargs: callable(*args, **kwargs)
Congratulations, you found the trivial case. Stefan -- http://mail.python.org/mailman/listinfo/python-list