Skip to content

Instantly share code, notes, and snippets.

@socrateslee
socrateslee / functor.py
Created May 28, 2014 06:23
A simple wrapper make a class become a functor.
'''
A simple wrapper make a class become a functor,
the class need a __call__ function. The (*sub,
**kwargs) will be passed for the __init__ function,
and the name of class will be the name of function
object.
Example
-------
@functor(*sub, **kwargs)