AOP decorator?

gentlestone tibor.beck at hotmail.com
Mon Mar 1 11:22:27 EST 2010


Hi,

suppose my source code looks like:
--------------------------------
  import aspect_xy
  class Basic(object, aspect_xy.Basic):
    pass # basic attributes and methods ...
--------------------------------
and the source code of aspect_xy.py is:
--------------------------------
  class Basic(object):
    pass  # aspect extra attributes and methods ...
--------------------------------
how can I write this with decorators? I want something like:
-------------------------------
  import aspect_xy
  @aspect_xy # extra attributes and methods ...
  class Basic(object):
    pass # basic attributes and methods ...
----------------------------------------------------------
I want to write class decorator function, which:
1. Takes the basic class as parameter
2. Find the same class name in aspect_xy.py
3. Inherit the found aspect class
Is it possible?









More information about the Python-list mailing list