You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ndarray printing is inconsistent across the platforms #13468
I think the different printing is to be probably a bit inconsistent at points, but has to be expected unfortunately due to differences between the long and ssize_t. @tylerjereddy can you point quickly on how we solve this in numpy, since I think we run such tests as well? If not, I may try to dig into it.
I made a detailed comment in the cross-linked scikit-image PR, which I've reproduced below. A consistent ecosystem solution would be useful, as discussed in many places, but there are some options at least for now.
Making the executable docstrings fully portable is indeed tricky--for NumPy and SciPy I think we do two things for this:
Typically just run the docstring checks on a single platform in CI
Improve portability by using refguide_check.py, which falls back to return np.allclose(want, got, atol=self.atol, rtol=self.rtol) when vanilla doctest doesn't think the results match; this almost certainly solves the problem you describe in the cognate NumPy issue
When I check the different results you mention in the cross-linked NumPy issue, I can see the refguide will likely indicate that these are the same because np.allclose(np.array([2, 0], dtype=np.int32), np.array([2, 0], dtype=np.int64)) is True, even though their reprs differ.
Thanks tyler! Interesting stuff, I hope it helps with this thing. It is interesting info here maybe, but probably can close (will go through the laballed issues anyway soon though).
OK, thanks @soupault. Closing it then, just pinging @ahaldane in case he has an opinion about changing print options. It seems to me that printing already does not print out the dtype, and only repr does (which arguably should normally).
Activity
seberg commentedon May 8, 2019
I think the different printing is to be probably a bit inconsistent at points, but has to be expected unfortunately due to differences between the
longandssize_t. @tylerjereddy can you point quickly on how we solve this in numpy, since I think we run such tests as well? If not, I may try to dig into it.tylerjereddy commentedon May 8, 2019
I made a detailed comment in the cross-linked scikit-image PR, which I've reproduced below. A consistent ecosystem solution would be useful, as discussed in many places, but there are some options at least for now.
seberg commentedon May 8, 2019
Thanks tyler! Interesting stuff, I hope it helps with this thing. It is interesting info here maybe, but probably can close (will go through the laballed issues anyway soon though).
soupault commentedon May 19, 2019
What do you think about adding a parameter to printoptions to suppress the
dtypefield (or even everything besides the numerical data) in the repr?Either way, please, feel free to close. I'm more or less fine with the current situation and glad that we're all aligned on this issue.
seberg commentedon May 19, 2019
OK, thanks @soupault. Closing it then, just pinging @ahaldane in case he has an opinion about changing print options. It seems to me that printing already does not print out the dtype, and only
reprdoes (which arguably should normally).