AOPython 1.0.2 has been released.

AOPython is an AOP (Aspect Oriented Programming) module for Python. AOPython 
provides a base 'Aspect' that can 'advise' or wrap function and/or method 
calls. It also contains a weave function that can weave (apply advice to a 
subset of- or all functions and methods in) a module, class, or instance. 
Advice may modify or replace parameters and/or the return value of the advised 
function or method each time it is called. It can do many other things such as 
handle exceptions raised by an advised function, collect information on the 
method call (logging), or obtain and release resources before and after a 
method is invoked.


Example 1: How to wrap a function

from aopython import Aspect
def negate(x):
    return -x
aspect = Aspect()
negate = aspect.wrap(negate)
negate(2) # advised function call


Example 2: How to weave a class

from aopython import Aspect
class MyObj(object):
    def double(self, x):
        return x * 2
    def tripple(self, x):
        return x * 3
aspect = Aspect()
aspect.weave(MyObj)
myobj = MyObj()
myobj.double(5) # advised method call
MyObj.tripple(myobj, 5) # advised method call


In this release the weave functionality has been enhanced to allow more 
flexible weaving of callables in modules, classes, or instances. An unweave 
function has been added to allow advice to be removed en-mass from an object 
that was previously weaved. Test coverage was also greatly improved, especially 
for the weave/unweave functions. See the change log for more details.

Download/leave comments/ask questions
http://www.openpolitics.com/pieces/archives/001710.html
Comments are appreciated.


<p><a href="http://www.openpolitics.com/pieces/archives/001710.html";>AOPython 
1.0.2</a> - Aspect Oriented Python (16-Aug-05)</p>


--
~ Daniel Miller
  [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

        Support the Python Software Foundation:
        http://www.python.org/psf/donations.html

Reply via email to