Issue 1726198: Line iteration readability (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/45002

classification

Title: Line iteration readability
Type: Stage:
Components: None Versions: Python 2.5

process

Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, joearmbruster, rhettinger
Priority: normal Keywords: patch

Created on 2007-05-26 20:13 by joearmbruster, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
forline.patch joearmbruster,2007-05-26 20:13
Messages (4)
msg52675 - (view) Author: Joseph Armbruster (joearmbruster) Date: 2007-05-26 20:13
I noticed there were several places that use the while 1: as opposed to the: for line in fp: approach to line-reading. This patch takes care of some of them that I grep'd out.
msg52676 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-05-27 06:21
The patch is fine. The first change should probably go a step further and use enumerate() for the lineno counts.
msg52677 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2007-05-27 06:39
On second thought, the change to ConfigParse should not go in. The docs currently promise that any file-like object supporting readling() will be accepted .
msg61422 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-01-21 17:22
I also left out the changes to the ftplib and distutils functions since they also accept file objects as parameters, to keep b/w compatibility. Committed the rest as r60163.
History
Date User Action Args
2022-04-11 14:56:24 admin set github: 45002
2008-01-21 17:22:49 georg.brandl set status: open -> closedassignee: georg.brandlresolution: acceptedmessages: + nosy: + georg.brandl
2007-05-26 20:13:14 joearmbruster create