diff options
author | Georg Brandl <georg@python.org> | 2007-04-21 15:47:16 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-04-21 15:47:16 (GMT) |
commit | a18af4e7a2091d11478754eb66ae387a85535763 (patch) | |
tree | fea8015d656cfee937bb6f3d106e6ca0e9f19d78 /Lib/tempfile.py | |
parent | 4d2adcca52ced412d4bdf131b872729c43520d58 (diff) | |
download | cpython-a18af4e7a2091d11478754eb66ae387a85535763.zip cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.gz cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.bz2 |
PEP 3114: rename .next() to .__next__() and add next() builtin.
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r-- | Lib/tempfile.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index f4f1058..0ebf6b4 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -124,7 +124,7 @@ class _RandomNameSequence: def __iter__(self): return self - def next(self): + def __next__(self): m = self.mutex c = self.characters choose = self.rng.choice @@ -191,7 +191,7 @@ def _get_default_tempdir(): dir = _os.path.normcase(_os.path.abspath(dir)) # Try only a few names per directory. for seq in xrange(100): - name = namer.next() + name = next(namer) filename = _os.path.join(dir, name) try: fd = _os.open(filename, flags, 0600) @@ -230,7 +230,7 @@ def _mkstemp_inner(dir, pre, suf, flags): names = _get_candidate_names() for seq in xrange(TMP_MAX): - name = names.next() + name = next(names) file = _os.path.join(dir, pre + name + suf) try: fd = _os.open(file, flags, 0600) @@ -322,7 +322,7 @@ def mkdtemp(suffix="", prefix=template, dir=None): names = _get_candidate_names() for seq in xrange(TMP_MAX): - name = names.next() + name = next(names) file = _os.path.join(dir, prefix + name + suffix) try: _os.mkdir(file, 0700) @@ -357,7 +357,7 @@ def mktemp(suffix="", prefix=template, dir=None): names = _get_candidate_names() for seq in xrange(TMP_MAX): - name = names.next() + name = next(names) file = _os.path.join(dir, prefix + name + suffix) if not _exists(file): return file |