Jul-21-2021, 06:29 AM
Hello,
I am working through a tutorial and lack the foundations to understand the following code
I am working through a tutorial and lack the foundations to understand the following code
class NodeVisitor(object): def visit(self, node): method_name = 'visit_' + type(node).__name__ visitor = getattr(self, method_name, self.generic_visit) return visitor(node)Can someone tell me what the visit method does? Many thanks!