[Numpy-discussion] loadtxt bug?

Alan G Isaac aisaac at american.edu
Fri Nov 23 07:58:13 EST 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.,
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.

Alan Isaac

More information about the NumPy-Discussion mailing list