
Hi,
Can someone take a look at: https://github.com/numpy/numpy/issues/7978
The crux of the issue is that this:
# This works a = "%0.3g" % np.array(2) a '2'
# This does not a = "{0:0.3g}".format(np.array(2)) TypeError: non-empty format string passed to object.__format__
I've now hit this in my code. If someone can even point me in the general direction of the code to dig into for this (please let it be python, please let it be python...), I'll dig in more.
Ryan

See this issue:
https://github.com/numpy/numpy/issues/5543
There was also a very thorough discussion of this recently on this mailing list:
http://numpy-discussion.10968.n7.nabble.com/Proposal-to-support-format-td439...
On Tue, Feb 28, 2017 at 11:32 AM Ryan May rmay31@gmail.com wrote:
Hi,
Can someone take a look at: https://github.com/numpy/numpy/issues/7978
The crux of the issue is that this:
# This works a = "%0.3g" % np.array(2) a '2'
# This does not a = "{0:0.3g}".format(np.array(2)) TypeError: non-empty format string passed to object.__format__
I've now hit this in my code. If someone can even point me in the general direction of the code to dig into for this (please let it be python, please let it be python...), I'll dig in more.
Ryan
-- Ryan May
NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion

I am hoping to submit a PR for a __format__ numpy enhancement proposal this weekend. I will be a slightly revised version of my original draft posted here two weeks ago. Ryan, if you have any thoughts on the writeup https://gist.github.com/gustavla/2783543be1204d2b5d368f6a1fb4d069 so far, I'd love to hear them.
On Tue, Feb 28, 2017 at 9:38 AM, Nathan Goldbaum nathan12343@gmail.com wrote:
See this issue:
https://github.com/numpy/numpy/issues/5543
There was also a very thorough discussion of this recently on this mailing list:
http://numpy-discussion.10968.n7.nabble.com/Proposal-to- support-format-td43931.html
On Tue, Feb 28, 2017 at 11:32 AM Ryan May rmay31@gmail.com wrote:
Hi,
Can someone take a look at: https://github.com/numpy/numpy/issues/7978
The crux of the issue is that this:
# This works a = "%0.3g" % np.array(2) a '2'
# This does not a = "{0:0.3g}".format(np.array(2)) TypeError: non-empty format string passed to object.__format__
I've now hit this in my code. If someone can even point me in the general direction of the code to dig into for this (please let it be python, please let it be python...), I'll dig in more.
Ryan
-- Ryan May
NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion

Gustav,
I had seen this discussion, but completely blanked when I posted my problem.
I looked over the proposal and nothing jumped out at me on a quick read-through; it seemed straightforward and would meet my needs.
I'll try to carve out some time to think a bit more about it and let you know if anything jumps out.
Ryan
On Tue, Feb 28, 2017 at 12:59 PM, Gustav Larsson larsson@cs.uchicago.edu wrote:
I am hoping to submit a PR for a __format__ numpy enhancement proposal this weekend. I will be a slightly revised version of my original draft posted here two weeks ago. Ryan, if you have any thoughts on the writeup https://gist.github.com/gustavla/2783543be1204d2b5d368f6a1fb4d069 so far, I'd love to hear them.
On Tue, Feb 28, 2017 at 9:38 AM, Nathan Goldbaum nathan12343@gmail.com wrote:
See this issue:
https://github.com/numpy/numpy/issues/5543
There was also a very thorough discussion of this recently on this mailing list:
http://numpy-discussion.10968.n7.nabble.com/Proposal-to-supp ort-format-td43931.html
On Tue, Feb 28, 2017 at 11:32 AM Ryan May rmay31@gmail.com wrote:
Hi,
Can someone take a look at: https://github.com/numpy/numpy/issues/7978
The crux of the issue is that this:
# This works a = "%0.3g" % np.array(2) a '2'
# This does not a = "{0:0.3g}".format(np.array(2)) TypeError: non-empty format string passed to object.__format__
I've now hit this in my code. If someone can even point me in the general direction of the code to dig into for this (please let it be python, please let it be python...), I'll dig in more.
Ryan
-- Ryan May
NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (3)
-
Gustav Larsson
-
Nathan Goldbaum
-
Ryan May