diff options
author | Guido van Rossum <guido@python.org> | 1998-02-19 21:08:36 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-02-19 21:08:36 (GMT) |
commit | 0d530cedd7563d75e33c488c742ea74f5f5a703b (patch) | |
tree | db27bacd911aba89f15e8c1023aed080f82eeb5f /Lib/dospath.py | |
parent | 505d80b39d5329f74774a2d68d5903e51098be7a (diff) | |
download | cpython-0d530cedd7563d75e33c488c742ea74f5f5a703b.zip cpython-0d530cedd7563d75e33c488c742ea74f5f5a703b.tar.gz cpython-0d530cedd7563d75e33c488c742ea74f5f5a703b.tar.bz2 |
Faster implementation of normcase (using string.lower(
string.replace(...)) instead of a for loop).
Don't call normcase() in normpath() -- the filesystem just might be
case preserving...
Diffstat (limited to 'Lib/dospath.py')
-rw-r--r-- | Lib/dospath.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/Lib/dospath.py b/Lib/dospath.py index e003db1..803ddb0 100644 --- a/Lib/dospath.py +++ b/Lib/dospath.py @@ -15,13 +15,7 @@ import string # possibly be added as a new function. def normcase(s): - res, s = splitdrive(s) - for c in s: - if c in '/\\': - res = res + os.sep - else: - res = res + c - return string.lower(res) + return string.lower(string.replace(s, "/", "\\")) # Return wheter a path is absolute. @@ -316,7 +310,7 @@ def expandvars(path): # Also, components of the path are silently truncated to 8+3 notation. def normpath(path): - path = normcase(path) + path = string.replace(path, "/", "\\") prefix, path = splitdrive(path) while path[:1] == os.sep: prefix = prefix + os.sep |