James Stroud wrote: > import functools > class enclosable(object): > def __init__(self, func): > self.func = func > def __call__(self, *args, **kwargs): > return functools.partial(self.func, *args, **kwargs) > > For example: > > @enclosable > def do_something_with(a, b): > [etc]
On second thought: def enclosable(func): def _f(*args, **kwargs): return functools.partial(func, *args, **kwargs) return _f I guess __call__ is not necessary for this decorator after all. James -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list