On 11/15/10 11:35 AM, Pauli Virtanen wrote:
> One can argue that this is a bug in Python or Numpy:
>
>       "%d" % numpy.int16(1)
>
>       "{0:d}".format(numpy.int16(1))

> To make it work via changes in Numpy: scalars should implement a
> __format__ method. Two choices: either we parse the formatting string
> ourselves, or forward formatting to Python. The PITA in implementing this
> is in parsing the format string.
>
> Doing formatting ourselves would allow e.g. formatting of long doubles
> properly, which cannot be done via the %-syntax.

Also good handling of NaN, which there is other custom code in numpy to 
handle better than python (in string parsing, anyway).

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[email protected]
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to