Description
This is another thing we bumped into our scikit-learn doctests using numpy dev. If this is easy for np.set_printoptions(legacy=True)
to use pre-dragon4 printing it would make our life (and the life of other downstream projects bumping into the same problems with doctests) a bit easier when numpy 1.14 is released.
I think the expected behaviour is that np.set_printoptions(legacy=True)
does revert to pre-dragon4 format even with all its flaws. If this is not too costly in terms of maintenance, maybe it could be considered? Note we can work-around this issue with doctests ellipsis in scikit-learn.
A snippet to illustrate what I mean in more details:
import numpy as np
try:
np.set_printoptions(legacy=True)
except TypeError:
pass
i = 6
numpy_number = np.float64(1.) - i * 1e-17
print('str : ', numpy_number)
print('repr : ', repr(numpy_number))
Output on numpy master:
str : 0.9999999999999999
repr : 0.9999999999999999
Output on numpy 1.13:
str : 1.0
repr : 0.99999999999999989
When using np.set_printoptions(legacy=True)
I would expect both output to match.