[Python-checkins] r55320 - python/trunk/Lib/genericpath.py

raymond.hettinger python-checkins at python.org
Mon May 14 22:52:36 CEST 2007


Author: raymond.hettinger
Date: Mon May 14 22:52:31 2007
New Revision: 55320

Modified:
   python/trunk/Lib/genericpath.py
Log:
Small speedup.

Modified: python/trunk/Lib/genericpath.py
==============================================================================
--- python/trunk/Lib/genericpath.py	(original)
+++ python/trunk/Lib/genericpath.py	Mon May 14 22:52:31 2007
@@ -70,11 +70,10 @@
     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


More information about the Python-checkins mailing list