[Numpy-discussion] Inconsistent error messages.

Stéfan van der Walt stefan@sun.ac...
Sat May 23 04:49:00 CDT 2009

2009/5/23 Charles R Harris <charlesr.harris@gmail.com>:
> In [9]: fromfile("empty.dat", count=10)
> 10 items requested but only 0 read
> ---------------------------------------------------------------------------
> MemoryError                               Traceback (most recent call last)
> /home/charris/<ipython console> in <module>()
> MemoryError:
> I think fromfile should also raise a ValueError in this case. Thoughts?

I'm also wondering why the MemoryError has an empty message string --
that should be fixed.

Instead of throwing errors in these scenarios, we could just return
the elements read and raise a warning?  This is consistent with most
other file APIs I know and allows you to read blocks of data until the
data runs out.


More information about the Numpy-discussion mailing list