ANN: AOPython 1.0.3

Daniel Miller millerdev at
Sat Mar 10 16:50:31 CET 2007

AOPython 1.0.3 has been released.

It's now available in the Cheese Shop!

This release is a very small update. Here are the details:
- Removed re/sre weave test from aopythonexamples (it didn't pass on Python 2.4 and it wasn't a good test).
- Improved Aspect.wrap() function
- Added


What is AOPython?

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()
myobj = MyObj()
myobj.double(5) # advised method call
MyObj.tripple(myobj, 5) # advised method call

Download/leave comments/ask questions
Comments are appreciated.

<p><a href="">AOPython 1.0.2</a> - Aspect Oriented Python (16-Aug-05)</p>

More information about the Python-announce-list mailing list