|
|
Features
In Python 2.1 and later (including Jython)
- All other methods except built-in methods can be wrapped.
- Wraps can be added, peeled, enabled and disabled on-the-fly.
- Wraps can be enabled in all instances of a class or only in given instances.
- Wraps can modify the arguments passed to the wrapped method.
- Wraps can modify the return value returned from the wrapped method.
- Wraps can handle exceptions raising from the wrapped method.
- The source code of the wrapped methods and their classes is not
needed. The byte code is enough.
- Thread safe: several threads can execute the same wrapped methods.
Additional features in Python 2.5 and later
- Functions (including many built-in functions) can be wrapped.
- Any wrap can be removed.
- Wraps are generators (that is, functions that yield)
- The execution of a wrap can be continued (instead of restarting)
when the wrapped method is called next time.
|