News for hackers. Stuff that matters.
Re:Python vs Ruby, slightly more in-depth by tetha on Wednesday August 05, 2009 @08:15AM (#743241)
Certainly, it is an arbitrary python function, so the resulting foo might be a dictionary or whatever. But this doesn't push it closer to the visitor pattern.

Certainly, you can use decorators as a tool to implement the visitor pattern by implementing some hairy, magical reflecting class-decorator which adds a method visit to an object, which then calls visit_{CLASSNAME} on the parameter, but this is just a way of implementing this and not the visitor pattern in itself.

There are no comments on this comment yet.