At 02:36 PM 1/12/2006 -0800, Brett Cannon wrote: >(I have a third, AOP for anything, but I don't think AOP is a good match >for Python and thus not considering it for Python work)
For what it's worth, I've been doing what I'll loosely refer to as "research" on implementing a non-traditional form of AOP in Python via the combination of extensible generic functions and contextual variables -- two concepts that already exist in Python but which can be extended far beyond what is in current use. The combination can be used to implement an "explicit is better than implicit" form of AOP, that is usually handled by a "weaving language" in classic AOP implementations. I don't know of any published AOP work that focuses on the use of these kinds of tools; the communities that talk about the respective technologies appear to be disjoint. Anyway, extensible generic operations in Python like 'len()', 'copy()' and so on are fairly common, but it's rare that people define their own such functions, as opposed to using ones in the stdlib. A typical workaround in larger frameworks is to use interfaces and adaptation, but extensible generic operations make it easier to separate concerns orthogonally. So, although you might think that AOP isn't "a good match for Python", the truth is that there's actually a fair amount of AOP-like things being done with Python. It's just that classic structuring of AOP into things like aspects and weavers and all that crud is overcomplication. If you view it simply in terms of extensible operations, which can also make decisions based on context, then you can achieve all the same goals of "classic" AOP without using any of its concepts or terminology. One definition of AOP claims that it allows asserting qualified statements over oblivious code. Python has this basic ability natively -- monkeypatching suffices to meet that definition. The interesting question is, how can you do it *without* monkeypatching? _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com