[Numpy-discussion] Re: Fwd: ndarray should offer __format__ that can adjust precision

2021-12-03 Thread Sebastian Berg
On Mon, 2021-07-26 at 01:04 -0400, Ivan Gonzalez wrote: > It would be nice to be able to use the Python syntax we already use to > format the precision of floating numbers in numpy: > > > > a = np.array([-np.pi, np.pi]) > > > > print(f"{a:+.2f}") > [-3.14 +3.14] > This is particularly useful when y

[Numpy-discussion] Re: Fwd: ndarray should offer __format__ that can adjust precision

2021-12-03 Thread Stephan Hoyer
On Fri, Dec 3, 2021 at 12:07 PM Sebastian Berg wrote: > This discussion has recently surfaced again and I am wondering what the > stance on it is for people? > > The PR is: https://github.com/numpy/numpy/pull/19550 > > I.e. that things like "f{arr:.2f}" would be enabled in certain cases, > at