-
-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I think it'd be a lot nicer if we used the string form instead of the repr form when formatting arrays:
>>> np.array([str(pi), str(pi+1)], dtype=npq.QuadPrecDType())
array([QuadPrecision('3.1415926535897932384626433832795e+000', backend='sleef'),
QuadPrecision('4.1415926535897932384626433832795e+000', backend='sleef')],
dtype=QuadPrecDType(backend='sleef'))
The current output repeats backend='sleef'
three times and uses the unnecessarily verbose format with QuadPrecision
showing up explicitly.
This is happening because of this choice:
>>> str(npq.QuadPrecision(str(pi)))
'3.1415926535897932384626433832795 '
>>> repr(npq.QuadPrecision(str(pi)))
"QuadPrecision('3.1415926535897932384626433832795e+000', backend='sleef')"
IMO it would be better if the array repr used the string form instead of the repr format.
Although that said, I'm not totally sure why there's trailing whitespace in the string format. That might be another bug.
Metadata
Metadata
Assignees
Labels
No labels