[Numpy-discussion] loadtxt bug?

Gael Varoquaux gael.varoquaux@normalesup....
Fri Nov 23 01:14:19 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()

> I believe there is a bug here (when a line has no comment).
> To illustrate::

>     >>> line = "12345"
>     >>> comments = "#"
>     >>> line[:line.find(comments)]
>     '1234'

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.

Gaël


More information about the Numpy-discussion mailing list