8000 set_string_function reset incomplete (Trac #1130) · Issue #1728 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

set_string_function reset incomplete (Trac #1130) #1728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thouis opened this issue Oct 19, 2012 · 3 comments
Closed

set_string_function reset incomplete (Trac #1130) #1728

thouis opened this issue Oct 19, 2012 · 3 comments

Comments

@thouis
Copy link
Contributor
thouis commented Oct 19, 2012

Original ticket http://projects.scipy.org/numpy/ticket/1130 on 2009-06-06 by @rgommers, assigned to unknown.

#!rst
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:

.. code-block:: python

  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 ability to reset the function by using None as argument was introduced in #949.

@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

Milestone changed to 1.4.0 by @cournape on 2009-11-25

@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

@pv wrote on 2010-07-18

Fixed in r8507

@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

@rgommers wrote on 2010-07-19

Test to see if I get Trac notifications now. Sorry for the noise.

@thouis thouis closed this as completed Oct 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0