Metaprogramming Example

Kay Schluehr kay.schluehr at gmx.net
Sat Apr 19 10:51:48 EDT 2008


On 17 Apr., 14:25, andrew cooke <and... at acooke.org> wrote:

> PS Is there anywhere that explains why Decorators (in the context of
> functions/methods) are so good?

We had kind of an inverse discussion a while ago when someone asked
about the fate of aspect oriented programming (AOP) in Python. My
answer was that technically "aspect weaving" using code generators is
dead in application programming [1] and decorators are handy,
lightweight, local and controllable while serving very similar
purposes.

[1] There are occasions where source code weaving might still has its
place. Profiling for example or code coverage. Just examine this
interesting blog article:

http://nedbatchelder.com/blog/200804/wicked_hack_python_bytecode_tracing.html

and the subsequent discussion.



More information about the Python-list mailing list