Package pypat :: Package behavioral :: Module visitor :: Class Visitor
[hide private]
[frames] | no frames]

Class Visitor

source code


Abstract Visitor class as part of the Visitor Design Pattern.

- External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage}
- External Visitor Design Pattern documentation: U{https://en.wikipedia.org/wiki/Visitor_pattern}

Instance Methods [hide private]
 
visit(self, node, *args, **kwargs)
Visit the visitor with some object.
source code
 
generic_visit(self, node, *args, **kwargs)
The method to call if no methods were found for a visiting object.
source code
Method Details [hide private]

visit(self, node, *args, **kwargs)

source code 

Visit the visitor with some object.

Parameters:
  • node - An object to call a visitor method with.
  • args - Arguments to go with the visitor method call.
  • kwargs - Keyword arguments to go with the visitor method call.
Returns:
The return value of the method that was called for visiting object.

generic_visit(self, node, *args, **kwargs)

source code 

The method to call if no methods were found for a visiting object.

Parameters:
  • node - An object to call a visitor method with.
  • args - Arguments to go with the visitor method call.
  • kwargs - Keyword arguments to go with the visitor method call.
Decorators:
  • @abstractmethod