[Patches] [ python-Patches-968063 ] Add fileinput.islastline()

SourceForge.net noreply at sourceforge.net
Tue Jun 15 08:05:41 EDT 2004


Patches item #968063, was opened at 2004-06-07 04:45
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=968063&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Relm Arrowny (relm)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add fileinput.islastline()

Initial Comment:
You can test for the first line of a file with 
fileinput.isfirstline(), but there is no corresponding 
fileinput.islastline() to test for the last line of a file.

Note that there is already an unapplied patch for this at 
request ID 776100, but it is faulty in that it only tests 
for end of buffer and not end of file.

I was not sure how to append this patch to the existing 
request, so have started a new one.  Hope this is okay.

This patch also includes documentation and test 
updates.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2004-06-15 07:05

Message:
Logged In: YES 
user_id=80475

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.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=968063&group_id=5470



More information about the Patches mailing list