From: Raymond Hettinger Date: Mon, 14 May 2007 20:52:31 +0000 (+0000) Subject: Small speedup. X-Git-Tag: v2.6a1~1745 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8be9ab84979cc09caf41177f101089e4feaae65b;p=python Small speedup. --- diff --git a/Lib/genericpath.py b/Lib/genericpath.py index e2bc7da0ab..73d7b26b3e 100644 --- a/Lib/genericpath.py +++ b/Lib/genericpath.py @@ -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