]> granicus.if.org Git - python/commitdiff
Small speedup.
authorRaymond Hettinger <python@rcn.com>
Mon, 14 May 2007 20:52:31 +0000 (20:52 +0000)
committerRaymond Hettinger <python@rcn.com>
Mon, 14 May 2007 20:52:31 +0000 (20:52 +0000)
Lib/genericpath.py

index e2bc7da0abad753d89431a89c76558c8d6c79aaf..73d7b26b3e27a137a1ff7897bb3143d5b7fd75bd 100644 (file)
@@ -70,11 +70,10 @@ def commonprefix(m):
     if not m: return ''
     s1 = min(m)
     s2 = max(m)
-    n = min(len(s1), len(s2))
-    for i in xrange(n):
-        if s1[i] != s2[i]:
+    for i, c in enumerate(s1):
+        if c != s2[i]:
             return s1[:i]
-    return s1[:n]
+    return s1
 
 # Split a path in root and extension.
 # The extension is everything starting at the last dot in the last