Kristján,
Here is a part of the patch that I was referring to. Something to that
effect.
Joseph Armbruster
Index: Lib/ConfigParser.py
===================================================================
--- Lib/ConfigParser.py (revision 55600)
+++ Lib/ConfigParser.py (working copy)
@@ -441,10 +441,7 @@
optname = None
lineno = 0
e = None # None, or an exception
- while True:
- line = fp.readline()
- if not line:
- break
+ for line in fp:
lineno = lineno + 1
# comment or blank line?
if line.strip() == '' or line[0] in '#;':
Index: Lib/distutils/sysconfig.py
===================================================================
--- Lib/distutils/sysconfig.py (revision 55600)
+++ Lib/distutils/sysconfig.py (working copy)
@@ -216,10 +216,7 @@
define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
#
- while 1:
- line = fp.readline()
- if not line:
- break
+ for line in fp:
m = define_rx.match(line)
if m:
n, v = m.group(1, 2)
@@ -254,10 +251,7 @@
done = {}
notdone = {}
- while 1:
- line = fp.readline()
- if line is None: # eof
- break
+ for line in fp:
m = _variable_rx.match(line)
if m:
n, v = m.group(1, 2)
Index: Lib/formatter.py
===================================================================
--- Lib/formatter.py (revision 55600)
+++ Lib/formatter.py (working copy)
@@ -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:
Index: Lib/ftplib.py
===================================================================
--- Lib/ftplib.py (revision 55600)
+++ Lib/ftplib.py (working copy)
@@ -435,9 +435,7 @@
'''Store a file in line mode.'''
self.voidcmd('TYPE A')
conn = self.transfercmd(cmd)
- while 1:
- buf = fp.readline()
- if not buf: break
+ for buff in fp:
if buf[-2:] != CRLF:
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
Index: Lib/keyword.py
===================================================================
--- Lib/keyword.py (revision 55600)
+++ Lib/keyword.py (working copy)
@@ -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:
Index: Lib/mimetypes.py
===================================================================
--- Lib/mimetypes.py (revision 55600)
+++ Lib/mimetypes.py (working copy)
@@ -204,10 +204,7 @@
list of standard types, else to the list of non-standard
types.
"""
- while 1:
- line = fp.readline()
- if not line:
- break
+ for line in fp:
words = line.split()
for i in range(len(words)):
if words[i][0] == '#':
Index: Lib/urlparse.py
===================================================================
--- Lib/urlparse.py (revision 55600)
+++ Lib/urlparse.py (working copy)
@@ -353,9 +353,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
Index: Tools/pynche/ColorDB.py
===================================================================
--- Tools/pynche/ColorDB.py (revision 55600)
+++ Tools/pynche/ColorDB.py (working copy)
@@ -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:
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com