class documentation

A node visitor base class that walks the abstract syntax tree and calls a visitor function for every node found. This function may return a value which is forwarded by the visit method. This class is meant to be subclassed, with the subclass adding visitor methods. Per default the visitor functions for the nodes are 'visit_' + class name of the node. So a ClassDef node visit function would be visit_ClassDef or alternatively visit_classdef. This behavior can be changed by overriding the visit method. If no visitor function exists for a node (return value None) the generic_visit visitor is used instead. Don't use the NodeVisitor if you want to apply changes to nodes during traversing. For this a special visitor exists (NodeTransformer) that allows modifications.

Note

Barely adapted from Python standard's library ast module.

Method generic_visit Called if no explicit visitor function exists for a node.
Method visit Visit a node.
def generic_visit(self, node): (source)

Called if no explicit visitor function exists for a node.

Parameters
node:astroid.nodes.NodeNGUndocumented
def visit(self, node): (source)

Visit a node.

Parameters
node:astroid.nodes.NodeNGUndocumented
Returns
AnyUndocumented