[pypy-svn] r49300 - pypy/dist/pypy/rlib

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Dec 2 21:22:23 CET 2007


Author: cfbolz
Date: Sun Dec  2 21:22:21 2007
New Revision: 49300

Modified:
   pypy/dist/pypy/rlib/rope.py
Log:
small beautifications


Modified: pypy/dist/pypy/rlib/rope.py
==============================================================================
--- pypy/dist/pypy/rlib/rope.py	(original)
+++ pypy/dist/pypy/rlib/rope.py	Sun Dec  2 21:22:21 2007
@@ -1042,13 +1042,12 @@
                 assert isinstance(node, BinaryConcatNode)
                 right = node.right
                 if right.length() > numchars:
-                    break
+                    self.tookleft.append(False)
+                    self.find_downward(right, numchars)
+                    return
                 numchars -= right.length()
             self.stack.pop()
-        else:
-            raise StopIteration
-        self.tookleft.append(False)
-        self.find_downward(right, numchars)
+        raise StopIteration
 
         
     def seekback(self, numchars):
@@ -1063,13 +1062,12 @@
                 assert isinstance(node, BinaryConcatNode)
                 left = node.left
                 if left.length() >= numchars:
-                    break
+                    self.tookleft.append(True)
+                    self.find_downward(left, left.length() - numchars)
+                    return
                 numchars -= left.length()
             self.stack.pop()
-        else:
-            raise StopIteration
-        self.tookleft.append(True)
-        self.find_downward(left, left.length() - numchars)
+        raise StopIteration
 
 
 class FindIterator(object):


More information about the pypy-svn mailing list