NEP 51: Change the represenatation of NumPy scalars

(Cross posting here from the NumPy mailing list for visibility)

I would like to propose changing the representation of NumPy scalars. Briefly, proposing to show the following:

  • np.float64(3.0) ­instead of just 3.0
  • np.True_ instead of True
  • np.void((3, 5), dtype=[('a', '<i8'), ('b', 'u1')]) instead of
    (3, 5)
  • Use np. rather than numpy. for datetime/timedelta.

This way it is clear for users that they are dealing with NumPy scalars which behave different from Python scalars. The str() that is given when using print() and the way arrays are shown will be unchanged.

The NEP draft can be found here:

and it includes more details and related changes.

The implementation is largely finished and can be found here. We are fairly late in the release cycle and the change should not block other things. So, the aim is to merge it early in the next release cycle. That way downstream has time to fix documentation is wanted.

Depending on how discussion goes, I hope to formally propose the NEP fairly soon, so that the merging the implementation doesn’t need to wait on NEP approval.