[Python-checkins] CVS: python/dist/src/Lib posixpath.py,1.35,1.36
Fred L. Drake
python-dev@python.org
Thu, 28 Sep 2000 08:04:42 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv31973
Modified Files:
posixpath.py
Log Message:
Remove imports of string when string methods will do.
Index: posixpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** posixpath.py 2000/08/22 13:01:53 1.35
--- posixpath.py 2000/09/28 15:04:39 1.36
***************
*** 58,63 ****
"""Split a pathname. Returns tuple "(head, tail)" where "tail" is
everything after the final slash. Either part may be empty"""
! import string
! i = string.rfind(p, '/') + 1
head, tail = p[:i], p[i:]
if head and head <> '/'*len(head):
--- 58,62 ----
"""Split a pathname. Returns tuple "(head, tail)" where "tail" is
everything after the final slash. Either part may be empty"""
! i = p.rfind('/') + 1
head, tail = p[:i], p[i:]
if head and head <> '/'*len(head):
***************
*** 345,351 ****
if path == '':
return '.'
- import string
initial_slash = (path[0] == '/')
! comps = string.split(path, '/')
new_comps = []
for comp in comps:
--- 344,349 ----
if path == '':
return '.'
initial_slash = (path[0] == '/')
! comps = path.split('/')
new_comps = []
for comp in comps:
***************
*** 358,362 ****
new_comps.pop()
comps = new_comps
! path = string.join(comps, '/')
if initial_slash:
path = '/' + path
--- 356,360 ----
new_comps.pop()
comps = new_comps
! path = '/'.join(comps)
if initial_slash:
path = '/' + path