avoid redundant Python type conversion in scanner
authorStefan Behnel <scoder@users.berlios.de>
Sat, 20 Mar 2010 17:07:43 +0000 (18:07 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 20 Mar 2010 17:07:43 +0000 (18:07 +0100)
Cython/Plex/Scanners.py

index c4181337006e52e6751cdabaca118a1c74e2c021..c8519047ef73df35ebbb1c7494161f67c63d3411 100644 (file)
@@ -138,8 +138,8 @@ class Scanner(object):
       if self.trace:
         print("Scanner: read: Performing %s %d:%d" % (
           action, self.start_pos, self.cur_pos))
-      base = self.buf_start_pos
-      text = self.buffer[self.start_pos - base : self.cur_pos - base]
+      text = self.buffer[self.start_pos - self.buf_start_pos :
+                         self.cur_pos   - self.buf_start_pos]
       return (text, action)
     else:
       if self.cur_pos == self.start_pos: