Re: [Numpy-discussion] Implementing __format__

2010-11-15 Thread Christopher Barker
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 forma

[Numpy-discussion] Implementing __format__

2010-11-15 Thread Pauli Virtanen
On Mon, 15 Nov 2010 09:20:43 -0600, Robert Kern wrote: [clip] > Correct. On a 64-bit system, numpy.int32 does not subtype from int. The > format codes do strict type-checking. One can argue that this is a bug in Python or Numpy: "%d" % numpy.int16(1) "{0:d}".format(numpy.int16(1)