[Numpy-discussion] loadtxt broken if file does not end in newline

Lisandro Dalcin dalcinl@gmail....
Wed Feb 27 15:02:18 CST 2008


Well, after all that said, I'm also fine with either approach. Anyway,
I would say that my personal preference is for the one using
'str.index', as it is the simplest one regarding the old code.

Like Christopher, I rarelly (never?) use 'loadtxt'. But this issue
made a coworker to get crazy (he is a newby in python/numpy).

BTW, I'm pretty sure that some time ago Guido agreed about the removal
of str.find for Py3k, but it is still there in py3k-repo. Feel free to
ask at python-dev if any of you consider it appropriate.

Regards,


On 2/27/08, Christopher Barker <Chris.Barker@noaa.gov> wrote:
> David Huard wrote:
>  > The advantage of using regular expressions is that in this case it gives
>  > you some flexibility that wasn't there before. For instance, if for any
>  > reason there are two type of characters that coexist in the file to mark
>  > comments, using
>
>  > pattern = re.compile(comments)
>
> > can take care of that automatically if comments is a regular expression.
>
>
> OK -- but loadtxt() doesn't support that now anyway. I'm not writing the
>  code, nor using it at the moment, so It's fine with me either way, but
>  the re should certainly support the examples I gave that don't work now.
>  (plus probably others, that's not a comprehensive list of possibilities.)
>
>  -CHB
>
>
>  > 2008/2/27, Christopher Barker <Chris.Barker@noaa.gov
>
>
> >     This pattern fails if the last character of the line is a comment
>  >     character, and if it is a comment only line
>
>
> --
>
> Christopher Barker, Ph.D.
>  Oceanographer
>
>  Emergency Response Division
>  NOAA/NOS/OR&R            (206) 526-6959   voice
>  7600 Sand Point Way NE   (206) 526-6329   fax
>  Seattle, WA  98115       (206) 526-6317   main reception
>
>  Chris.Barker@noaa.gov
>  _______________________________________________
>  Numpy-discussion mailing list
>  Numpy-discussion@scipy.org
>  http://projects.scipy.org/mailman/listinfo/numpy-discussion
>


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


More information about the Numpy-discussion mailing list