[Python-Dev] Implement Aspect-oriented programming

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Jun 13 18:25:11 CEST 2011


Jiawei Li <jiawei.h.li <at> gmail.com> writes:

> For example, the logging module is not very useful right now, as it requires
sprinkling small one-liners all over my code - not exactly ideal.
> Why not take a page from aspect-oriented programming and allow for injection
of code with point cuts?

If you're only interested in logging method entry and exit - in which case,
you're not really using logging to its full potential - then an AOP style
approach may work for you. But the point of logging is to send messages to
yourself (and others) from your code, and an AOP approach will not lend itself
to intelligent, context-sensitive messages.

Regards,

Vinay Sajip






More information about the Python-Dev mailing list