[Python-checkins] r60163 - in python/trunk: Lib/formatter.py Lib/keyword.py Lib/urlparse.py Tools/pynche/ColorDB.py
georg.brandl
python-checkins at python.org
Mon Jan 21 18:22:07 CET 2008
Author: georg.brandl
Date: Mon Jan 21 18:22:06 2008
New Revision: 60163
Modified:
python/trunk/Lib/formatter.py
python/trunk/Lib/keyword.py
python/trunk/Lib/urlparse.py
python/trunk/Tools/pynche/ColorDB.py
Log:
#1726198: replace while 1: fp.readline() with file iteration.
Modified: python/trunk/Lib/formatter.py
==============================================================================
--- python/trunk/Lib/formatter.py (original)
+++ python/trunk/Lib/formatter.py Mon Jan 21 18:22:06 2008
@@ -432,10 +432,7 @@
fp = open(sys.argv[1])
else:
fp = sys.stdin
- while 1:
- line = fp.readline()
- if not line:
- break
+ for line in fp:
if line == '\n':
f.end_paragraph(1)
else:
Modified: python/trunk/Lib/keyword.py
==============================================================================
--- python/trunk/Lib/keyword.py (original)
+++ python/trunk/Lib/keyword.py Mon Jan 21 18:22:06 2008
@@ -62,9 +62,7 @@
fp = open(iptfile)
strprog = re.compile('"([^"]+)"')
lines = []
- while 1:
- line = fp.readline()
- if not line: break
+ for line in fp:
if '{1, "' in line:
match = strprog.search(line)
if match:
Modified: python/trunk/Lib/urlparse.py
==============================================================================
--- python/trunk/Lib/urlparse.py (original)
+++ python/trunk/Lib/urlparse.py Mon Jan 21 18:22:06 2008
@@ -306,9 +306,7 @@
except ImportError:
from StringIO import StringIO
fp = StringIO(test_input)
- while 1:
- line = fp.readline()
- if not line: break
+ for line in fp:
words = line.split()
if not words:
continue
Modified: python/trunk/Tools/pynche/ColorDB.py
==============================================================================
--- python/trunk/Tools/pynche/ColorDB.py (original)
+++ python/trunk/Tools/pynche/ColorDB.py Mon Jan 21 18:22:06 2008
@@ -50,10 +50,7 @@
self.__byname = {}
# all unique names (non-aliases). built-on demand
self.__allnames = None
- while 1:
- line = fp.readline()
- if not line:
- break
+ for line in fp:
# get this compiled regular expression from derived class
mo = self._re.match(line)
if not mo:
More information about the Python-checkins
mailing list