Code generator and visitor pattern

Stefan Behnel stefan_ml at behnel.de
Fri Jul 16 04:25:19 EDT 2010


Carl Banks, 16.07.2010 07:50:
> On Jul 15, 8:33 pm, Stefan Behnel wrote:
>> The code I referenced is from the Cython compiler, and we use it to "do
>> stuff" with the AST. The visitor pattern is actually a pretty common way to
>> bind code in a single place that does a certain thing to different parts of
>> a data structure. Without it, if you kept that code *inside* of the data
>> structure, you'd have to spill the type specific parts all over your code.
>
> Ahh, so this aspect oriented programming is it.

Never thought about it that way, but you have a point there. It's pretty 
much the same idea as AOP, but without any of those huge and feature 
drooling code injection frameworks.

Stefan




More information about the Python-list mailing list