[Numpy-discussion] numpy.loadtxt requires seek()?

Ryan May rmay31@gmail....
Thu Nov 20 13:58:33 CST 2008


Stéfan van der Walt wrote:
> 2008/11/20 Ryan May <rmay31@gmail.com>:
>> Does anyone know why numpy.loadtxt(), in checking the validity of a
>> filehandle, checks for the seek() method, which appears to have no
>> bearing on whether an object will work?
> 
> I think this is simply a naive mistake on my part.  I was looking for
> a way to identify files; your patch would be welcome.

I've attached a simple patch that changes the check for seek() to a
check for readline().  I'll punt on my idea of just using iterators,
since that seems like slightly greater complexity for no gain. (I'm not
sure how many people end up with data in a list of strings and wish they
could pass that to loadtxt).

While you're at it, would you commit my patch to add support for bzipped
files as well (attached)?

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: loadtxt_bzip2_support.diff
Url: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081120/cf9e41be/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: loadtxt_filecheck_readline.diff
Url: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081120/cf9e41be/attachment-0001.pl 


More information about the Numpy-discussion mailing list