[Numpy-discussion] Proposal to support __format__
shoyer at gmail.com
Tue Feb 14 18:59:49 EST 2017
On Tue, Feb 14, 2017 at 3:34 PM, Gustav Larsson <larsson at cs.uchicago.edu>
> 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/
> and I will re-iterate some of the points made there and build off of that.
> have been thinking about this a lot in the last few weeks and my thoughts
> into a fairly fleshed out proposal. The discussion should probably start
> 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
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:
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion