[NumPy-Tickets] [NumPy] #1575: format gives ValueError when passed float32

NumPy Trac numpy-tickets@scipy....
Tue Nov 15 21:37:45 CST 2011


#1575: format gives ValueError when passed float32
----------------------------+-----------------------------------------------
 Reporter:  crm             |       Owner:  somebody
     Type:  defect          |      Status:  new     
 Priority:  normal          |   Milestone:          
Component:  numpy.core      |     Version:  1.4.0   
 Keywords:  format float32  |  
----------------------------+-----------------------------------------------

Comment(by pfctdayelise):

 It's not just Windows, also on Linux (Fedora 14) with Python 2.7.1.

 >>> 'hello {:.1f}'.format(1.39)
 'hello 1.4'

 >>> 'hello {:.1f}'.format(np.float64(1.39))
 'hello 1.4'

 >>> 'hello {:.1f}'.format(np.float32(1.39))
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
 ValueError: Unknown format code 'f' for object of type 'str'

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1575#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list