mirror of
https://github.com/python/cpython.git
synced 2025-09-13 20:27:05 +00:00
Small speedup.
This commit is contained in:
parent
cd498be90e
commit
8be9ab8497
1 changed files with 3 additions and 4 deletions
|
@ -70,11 +70,10 @@ def commonprefix(m):
|
||||||
if not m: return ''
|
if not m: return ''
|
||||||
s1 = min(m)
|
s1 = min(m)
|
||||||
s2 = max(m)
|
s2 = max(m)
|
||||||
n = min(len(s1), len(s2))
|
for i, c in enumerate(s1):
|
||||||
for i in xrange(n):
|
if c != s2[i]:
|
||||||
if s1[i] != s2[i]:
|
|
||||||
return s1[:i]
|
return s1[:i]
|
||||||
return s1[:n]
|
return s1
|
||||||
|
|
||||||
# Split a path in root and extension.
|
# Split a path in root and extension.
|
||||||
# The extension is everything starting at the last dot in the last
|
# The extension is everything starting at the last dot in the last
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue