On Nov 27, 9:28 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > "Aaron Brady" <[EMAIL PROTECTED]> wrote: ... > >As you can see, the 'visit' method is mechanical for classes A and B. > >One might want to autogenerate those in some languages, but Python has > >introspection: > > >class BaseAB: > > def visit( self, vis ): > > getattr( vis, 'visit_%s'% self.__class__.__name__ )( self ) > > >And it's easier to modify the default behavior this way than in > >autogenerated code too. > > This is kind of the wrong way around - this is an example of > OO jiggery pokery that will be difficult to do by generating the > source code - are there things that can be done by generating > the source code that cannot be done with OO?
Yes, I was examining the special case of generating OO code. -- http://mail.python.org/mailman/listinfo/python-list