[Numpy-discussion] missing string formatting functionality?

Benjamin Root ben.root at ou.edu
Mon Jul 19 10:58:03 EDT 2010


On Thu, Jul 15, 2010 at 7:53 AM, Neal Becker <ndbecker2 at gmail.com> wrote:

> It looks like np.savetxt is pretty flexible, accepting fmt, and delimiter
> args.  But to format into a string, we have array_repr and array_str, which
> are not flexible.
>
> Of course, one can use np.savetxt with python stringio, but that's more
> work.  Would be nice if np.savetxt could just return a string.  Better
> still, if np.savestring (returning a string) would implement core
> functionality, and np.savetxt would just us it.
>
>
At first, I was thinking that this might not be a bad idea, however, on
second thought there might be memory issues.  Probably not huge memory
issues, but depending on the amount of data, it might be too costly in the
general use case.  I would guess that doing a StringIO approach would
probably be better than reworking savetxt.  Because savetxt already accepts
a file-like object, StringIO fits very nicely to the existing numpy
framework.

My 2 cents...

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100719/4e5e9f83/attachment.html>


More information about the NumPy-Discussion mailing list