[Docstring-checkins] CVS: dps/spec dps-notes.txt,1.24,1.25
Status: Pre-Alpha
Brought to you by:
goodger
From: David G. <go...@us...> - 2002-02-13 02:25:31
|
Update of /cvsroot/docstring/dps/spec In directory usw-pr-cvs1:/tmp/cvs-serv17976/dps/spec Modified Files: dps-notes.txt Log Message: updated Index: dps-notes.txt =================================================================== RCS file: /cvsroot/docstring/dps/spec/dps-notes.txt,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dps-notes.txt 7 Feb 2002 02:03:30 -0000 1.24 --- dps-notes.txt 13 Feb 2002 02:25:29 -0000 1.25 *************** *** 440,473 **** - Visitors - ======== - - To nodes.py, add ``Node.walkabout()``, ``Visitor.leave_*()``, and - ``GenericVisitor.default_leave()`` methods to catch elements on the - way out? Here's ``Node.walkabout()``:: - - def walkabout(self, visitor, ancestry=()): - """ - Traverse a tree of `Node` objects. Call `visitor`'s - ``visit_...`` method (upon initial entry) **and** its - ``leave_...`` method (before exiting). - - Parameters: - - - `visitor`: A `Visitor` object, containing a ``visit_...`` - and ``leave_...`` method for each `Node` subclass - encountered. - - `ancestry`: A list of (parent, index) pairs. `self`'s parent - is the last entry. - """ - method = getattr(visitor, 'visit_' + self.__class__.__name__) - method(self, ancestry) - children = self.getchildren() - for i in range(len(children)): - children[i].walkabout(visitor, ancestry + ((self, i),)) - method = getattr(visitor, 'leave_' + self.__class__.__name__) - method(self, ancestry) - - Mixing Automatic and Manual Footnote Numbering ============================================== --- 440,443 ---- |