[Python-checkins] python/dist/src/Lib posixpath.py,1.63,1.64
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Wed Dec 31 17:44:31 EST 2003
- Previous message: [Python-checkins]
python/nondist/sandbox/parrotbench README.txt, 1.4,
1.5 b0.py, 1.7, 1.8 b4.py, 1.2, 1.3 out0, 1.5, 1.6 out4, 1.3, 1.4
- Next message: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.143.8.9,
1.143.8.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv13466
Modified Files:
posixpath.py
Log Message:
SF Patch 681780: Faster commonprefix (OS independent)
Improved based on discussions at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252177
http://groups.google.com/groups?th=fc7b54f11af6b24e&seekm=bss2so$om$00$1@news.t-online.com
Index: posixpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** posixpath.py 2 Nov 2003 09:47:05 -0000 1.63
--- posixpath.py 31 Dec 2003 22:44:29 -0000 1.64
***************
*** 124,137 ****
"Given a list of pathnames, returns the longest common leading component"
if not m: return ''
! prefix = m[0]
! for item in m:
! for i in range(len(prefix)):
! if prefix[:i+1] != item[:i+1]:
! prefix = prefix[:i]
! if i == 0:
! return ''
! break
! return prefix
!
# Get size, mtime, atime of files.
--- 124,134 ----
"Given a list of pathnames, returns the longest common leading component"
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]:
! return s1[:i]
! return s1[:n]
# Get size, mtime, atime of files.
- Previous message: [Python-checkins]
python/nondist/sandbox/parrotbench README.txt, 1.4,
1.5 b0.py, 1.7, 1.8 b4.py, 1.2, 1.3 out0, 1.5, 1.6 out4, 1.3, 1.4
- Next message: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.143.8.9,
1.143.8.10
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list