Small speedup.

This commit is contained in:
Raymond Hettinger 2007-05-14 20:52:31 +00:00
parent cd498be90e
commit 8be9ab8497
1 changed files with 3 additions and 4 deletions

View 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