[Python-checkins] cpython (2.7): No reason to use a generator here

nick.coghlan python-checkins at python.org
Fri Oct 19 15:59:44 CEST 2012


http://hg.python.org/cpython/rev/422a0175bbf5
changeset:   79839:422a0175bbf5
branch:      2.7
parent:      79831:df83d3bbd934
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Fri Oct 19 23:59:35 2012 +1000
summary:
  No reason to use a generator here

files:
  Lib/test/test_import.py |  17 ++++++++---------
  1 files changed, 8 insertions(+), 9 deletions(-)


diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -15,16 +15,15 @@
 from test import symlink_support
 from test import script_helper
 
-def _iter_files(name):
-    for f in (name + os.extsep + "py",
-              name + os.extsep + "pyc",
-              name + os.extsep + "pyo",
-              name + os.extsep + "pyw",
-              name + "$py.class"):
-        yield f
+def _files(name):
+    return (name + os.extsep + "py",
+            name + os.extsep + "pyc",
+            name + os.extsep + "pyo",
+            name + os.extsep + "pyw",
+            name + "$py.class")
 
 def chmod_files(name):
-    for f in _iter_files(name):
+    for f in _files(name):
         try:
             os.chmod(f, 0600)
         except OSError as exc:
@@ -32,7 +31,7 @@
                 raise
 
 def remove_files(name):
-    for f in _iter_files(name):
+    for f in _files(name):
         unlink(f)
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list