Hi,
I'm wondering if there's some way to format the way a YTQuantity prints,
for example the number of decimal places. Simply using print() leads to
many decimal places and includes the units. It's nice to have the units
included automatically, but would also be good to have control over the
number of decimal places.
Actually, from looking at the source I see how the __str__ method for
YTArray and YTQuantity objects is defined, which would indicate that no
such formatting is possible, as built in -- though I suppose one could use
the value and units parts to do the outputting. It might be nice to have a
simple method built in like say valunit(x) which would return a tuple of
the value and unit so then you could do
print('{:.4f} {}'.format(x.valunit()))
Jon
--
________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
jslavin(a)cfa.harvard.edu 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
________________________________________________________