]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
a few more tweaks
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Mar 2008 00:02:45 +0000 (00:02 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 25 Mar 2008 00:02:45 +0000 (00:02 +0000)
lib/sqlalchemy/sql/visitors.py

index 57dfb4b96db1b61b65ed04251fffec5fb2a03c7b..09d5a0982c41da2c2948867e6388ad0bbb2c3514 100644 (file)
@@ -49,7 +49,7 @@ class ClauseVisitor(object):
                 stack.append(c)
     
     def traverse(self, obj, clone=False):
-        """traverse the given expression structure.
+        """traverse and visit the given expression structure.
         
         Returns the structure given, or a copy of the structure if
         clone=True.
@@ -151,7 +151,7 @@ class ClauseVisitor(object):
         """iterate through this visitor and each 'chained' visitor."""
         
         v = self
-        while v is not None:
+        while v:
             yield v
             v = getattr(v, '_next', None)
     _iterate_visitors = property(_iterate_visitors)
@@ -161,9 +161,7 @@ class ClauseVisitor(object):
         
         the chained visitor will receive all visit events after this one.
         """
-        tail = self
-        while getattr(tail, '_next', None) is not None:
-            tail = tail._next
+        tail = list(self._iterate_visitors)[-1]
         tail._next = visitor
         return self