[Numpy-discussion] resetting set_string_function

Ralf Gommers ralf.gommers at googlemail.com
Sun May 31 20:19:37 EDT 2009


Hi,

There seems to be a bug in set_string_function when resetting the formatting
function to the default. After doing that the dtype of the array that is
printed is the character string, not the numpy type. Example:

In [1]: a=arange(10, dtype=uint16)

In [2]: a
Out[2]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], dtype=uint16)

In [3]: set_string_function(lambda x: str(x*2))

In [4]: a
Out[4]: [ 0  2  4  6  8 10 12 14 16 18]

In [5]: set_string_function(None)   # reset to default

In [6]: a
Out[6]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 'H')


The functionality to reset to default was introduced here:
http://projects.scipy.org/numpy/ticket/351
Should I open a trac ticket, or am I missing something here?

Cheers,
Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090531/96ff9297/attachment.html>


More information about the NumPy-Discussion mailing list