Issue776100
Created on 2003-07-23 07:49 by edhi, last changed 2022-04-10 16:10 by admin. This issue is now closed.
Files |
|
|
|
File name |
Uploaded |
Description |
Edit |
fileinput.diff |
edhi,2003-07-23 07:49 |
|
|
Messages (3) |
|
|
msg53949 - (view) |
Author: Edouard Hinard (edhi) |
Date: 2003-07-23 07:49 |
a function 'islastline' is missing to fileinput module. when that function exists, it is possible to perform an action at the end of a file like in: for line in fileinput.input(): processline(line) if fileinput.lastline(): processfile() Without this function, the same script looks like: for line in fileinput.input(): if fileinput.isfirstline() and fileinput.lineno() != 1: processfile() processline(line) processfile() |
|
|
msg53950 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2004-06-15 12:09 |
Logged In: YES user_id=80475 Reclassifying as a feature request. I'm -0 on complicating this venerable interface. Also, I find it unnatural for the inside of a loop to be able to ascertain whether it is in its final iteration. The closest approximation is the for-else clause which is vary rarely used in normal python programming. While the OP was able to sketch a use case, it involved only saving a couple of lines over what can be done with the existing API. P.S. There is a less buggy version of the patch at www.python.org/sf/968063 |
|
|
msg81710 - (view) |
Author: Daniel Diniz (ajaksu2) *  |
Date: 2009-02-12 02:56 |
Issue 968063 has better patch, use case and discussion. |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-10 16:10:10 |
admin |
set |
github: 38911 |
2009-02-12 02:56:48 |
ajaksu2 |
set |
status: open -> closednosy: + ajaksu2messages: + resolution: duplicatesuperseder: Add fileinput.islastline()stage: resolved |
2003-07-23 07:49:10 |
edhi |
create |
|