[issue968063] Add fileinput.islastline()

2022-04-02 Thread Irit Katriel


Irit Katriel  added the comment:

I am closing this as the discussion ended in 2017 with something like three +0s.

Please raise this for discussion on python-ideas if you would like to pursue it 
further.

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2022-04-02 Thread Irit Katriel


Irit Katriel  added the comment:

> This doesn't work because fileinput.filename()  and fileinput.filelineno()  
> are going to be wrong and pointing to the next file.


You won't have this problem if you work on one file at a time.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2017-04-29 Thread John Tapsell

John Tapsell added the comment:

> If you need islastline() you can use a wrapper:

This doesn't work because fileinput.filename()  and fileinput.filelineno()  are 
going to be wrong and pointing to the next file.

--
nosy: +John Tapsell

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is outdated. It uses private _buffer attribute which no longer exist 
(see issue15068). But even when _buffer was existing the patch was not correct, 
because _buffer contained only a part of the file.

It is possible to implement islastline(), but at the cost of additional 
buffering. This effectively negates the result of issue15068. The user would 
need to enter two lines first than fileinput could return the fist one from 
stdin. And additional complication slows down reading for all users even if 
they don't need islastline().

If you need islastline() you can use a wrapper:

def yield_line_and_islastline(f):
try:
prevline = next(f)
except StopIteration:
return
for line in f:
yield (prevline, f.isfirstline())
prevline = line
yield prevline, True

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2017-02-05 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the updated patch, but I'm not sure FileInput class needs a 
islastline() method. I couldn't find any similar or duplicate feature requests 
on the tracker after this opened in 2004 (which is a sign that the need for 
this method is low.)

Also, the patch needs some work. Some comments:

* There is no documentation changes to Doc/library/fileinput.rst
* 'mark' is unused in Lib/fileinput.py
* Not sure why we need 't1 = t2 = t3 = None' in tests
* We could use self.addCleanup() instead of 'try...finally'
* fileinput.islastline() is not tested. We could reuse 
Test_fileinput_isfirstline.

According to commit history of Lib/fileinput.py, Serhiy has done a lot of work 
in the past few years. I just added him to nosy list to get his feedback.

--
nosy: +berker.peksag, serhiy.storchaka
stage: needs patch -> patch review
versions: +Python 3.7 -Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2017-01-27 Thread Saurav Singh

Saurav Singh added the comment:

last patch works fine i have applied and tested the patch.Its documented 
well.Can we please have it reviewed?

--
nosy: +Saurav Singh

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2014-02-03 Thread Mark Lawrence

Changes by Mark Lawrence breamore...@yahoo.co.uk:


--
nosy:  -BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue968063
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2013-04-20 Thread Mark Lawrence

Mark Lawrence added the comment:

The latest patch still applies cleanly, can we have it reviewed please.

--
nosy: +BreamoreBoy
versions: +Python 3.4 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue968063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2011-05-29 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

Would storing len(self._buffer) in the instance be premature optimization?

--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue968063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2011-02-26 Thread Dj Gilcrease

Dj Gilcrease digitalx...@gmail.com added the comment:

Updated the patch and tests for py3.3

--
keywords: +patch
nosy: +Digitalxero
Added file: http://bugs.python.org/file20928/cpython_rev68060.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue968063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2011-01-06 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Anyone wants to produce an up-to-date patch for py3k?

--
keywords: +easy -patch
nosy: +pitrou
stage:  - needs patch
type:  - feature request
versions: +Python 3.3 -Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue968063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue968063] Add fileinput.islastline()

2009-02-11 Thread Daniel Diniz

Daniel Diniz aja...@gmail.com added the comment:

Issue issue 776100 closed as duplicated.

--
nosy: +ajaksu2
priority: normal - low
versions: +Python 2.6 -Python 2.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue968063
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com