
On Tue, Feb 14, 2017 at 3:34 PM, Gustav Larsson <larsson@cs.uchicago.edu> wrote:
Hi everyone!
I want to discuss adding support for __format__ in ndarray and I am willing to contribute code-wise once consensus has been reached. It was briefly discussed on GitHub two years ago (https://github.com/numpy/ numpy/issues/5543) and I will re-iterate some of the points made there and build off of that. I have been thinking about this a lot in the last few weeks and my thoughts turned into a fairly fleshed out proposal. The discussion should probably start more high-level, so I apologize if the level of detail is inappropriate at this point in time.
I decided on a gist, since the email got too long and clear formatting helps:
https://gist.github.com/gustavla/2783543be1204d2b5d368f6a1fb4d069
This is a lovely and clearly written document. Thanks for taking the time to think through this! I encourage you to submit it as a pull request to the NumPy repository as a "NumPy Enhancement Proposal", either now or after we've discussed it: https://docs.scipy.org/doc/numpy-dev/neps/index.html
OK, those are my thoughts for now. What do you think?
Two thoughts for now: 1. For object arrays, I would default to calling format on each element (your "map principle") rather than raising an error. 2. It's absolutely OK to leave functionality unimplemented and not immediately nail down every edge case. As a default, I would suggest raising errors whenever non-empty type specifications are provided rather than raising errors in every case.