On 16 mai, 23:23, [EMAIL PROTECTED] wrote:
> Thanks for the responses.  I'm well aware that the function can be
> passed in the parameters, passing in the functino as an arg defeats
> the purpose of what I'm going after.

Why so ?

> @ Arnaud - Nice. I'm not sure what the performance of mine vs. yours,
> but a perfunctory glance looks like we're doing the close to the same
> thing.  Maybe one advanage to doing it wrap(x).foo().... is that you
> can pass in other parameters to foo.

I may be wrong (if so please pardon my lack of intelligence and/or
provide a couple use case), but it looks like you're trying to
reinvent partial application.

from functools import partial
def foo(x, y):
  return x + y

pfoo = partial(foo, 2)
print pfoo(42)

Don't know if this helps...
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to