[Numpy-discussion] loadtxt bug?

Alan G Isaac aisaac@american....
Fri Nov 23 06:58:13 CST 2007


> On Thu, Nov 22, 2007 at 11:14:07PM -0500, Alan G Isaac wrote:
>> In numpy.core.numeric.py you will find loadtxt, which uses 
>> the following::
>>         line = line[:line.find(comments)].strip()



On Fri, 23 Nov 2007, Gael Varoquaux apparently wrote:
> Unless you are sure that line always ends with a "\n". This is the case 
> in the code you are refering too. Unless I am missing some thing. 


I am not understanding your comment here.  In the line of 
code above, is there a problem or not?

Specifically, is it not the case that the last line of 
a text file is not guaranteed to have a terminator?  E.g.,
<URL:http://www.neppert.com/ioutilities/doc/com/neppert/io/TextReader.html>
Does this not raise the possibility that a digit will be 
clipped from the last line?

Of course strip will afterwards strip any line terminators.

Cheers,
Alan Isaac





More information about the Numpy-discussion mailing list