[Python-checkins] r86351 - python/branches/py3k/Lib/tempfile.py
raymond.hettinger
python-checkins at python.org
Tue Nov 9 04:43:58 CET 2010
Author: raymond.hettinger
Date: Tue Nov 9 04:43:58 2010
New Revision: 86351
Log:
Simplify code
Modified:
python/branches/py3k/Lib/tempfile.py
Modified: python/branches/py3k/Lib/tempfile.py
==============================================================================
--- python/branches/py3k/Lib/tempfile.py (original)
+++ python/branches/py3k/Lib/tempfile.py Tue Nov 9 04:43:58 2010
@@ -108,30 +108,19 @@
_RandomNameSequence is an iterator."""
- characters = ("abcdefghijklmnopqrstuvwxyz" +
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
- "0123456789_")
+ characters = "abcdefghijklmnopqrstuvwxyz0123456789_"
def __init__(self):
- self.mutex = _allocate_lock()
self.rng = _Random()
- self.normcase = _os.path.normcase
def __iter__(self):
return self
def __next__(self):
- m = self.mutex
c = self.characters
choose = self.rng.choice
-
- m.acquire()
- try:
- letters = [choose(c) for dummy in "123456"]
- finally:
- m.release()
-
- return self.normcase(''.join(letters))
+ letters = [choose(c) for dummy in "123456"]
+ return ''.join(letters)
def _candidate_tempdir_list():
"""Generate a list of candidate temporary directories which
More information about the Python-checkins
mailing list