[Numpy-discussion] loadtxt bug?

Gael Varoquaux gael.varoquaux at normalesup.org
Fri Nov 23 08:51:25 EST 2007

On Fri, Nov 23, 2007 at 07:58:13AM -0500, Alan G Isaac wrote:
> > 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?

I don't know.

> Specifically, is it not the case that the last line of 
> a text file is not guaranteed to have a terminator?  

This is what I do not know, and I would appreciate to be enlightened.

> Does this not raise the possibility that a digit will be 
> clipped from the last line?

Yes. If the line does not end by a terminator you have a problem.

Sorry if I am adding more confusion than help, I was just raising another
question, or rather a comment on your question, rather than giving an


More information about the NumPy-Discussion mailing list