[pypy-issue] [issue1066] numpypy can't print float64's

Joseph Perla tracker at bugs.pypy.org
Tue Feb 21 16:43:01 CET 2012


New submission from Joseph Perla <pypy.org at jperla.com>:

I can't print numpypy.flaot64, even though I can easily use float() or str() on 
it to turn it into a string.

This problem probably occurs for other numpypy types as well.


unsupported operand types for format: 'float64', 'str'
> /home/princeton_ram/happynews/model/topiclib.py(722)lda_E_step_for_doc()
-> print "{2}: done LDA e-step on doc {3}: {0} iterations ELBO: {1}".format(i, 
local_elbo, global_iteration, d)
(Pdb) p local_elbo
-4.35704805568e-11
(Pdb) p i
20
(Pdb) p type(local_elbo)
<type 'numpypy.float64'>
(Pdb) p str(local_elbo)
'-4.35704805568e-11'
(Pdb) p 'bla {0}'.format(local_elbo)
*** TypeError: TypeError("unsupported operand types for format: 'float64', 
'str'",)
(Pdb) p 'bla {0}'.format(str(local_elbo))
'bla -4.35704805568e-11'
(Pdb) p 'bla {0}'.format(float(local_elbo))
'bla -4.35704805568e-11'
(Pdb)

----------
messages: 3992
nosy: pypy-issue
priority: critical
status: unread
title: numpypy can't print float64's

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1066>
________________________________________


More information about the pypy-issue mailing list