How to print floating point in scientific format?
aleax at aleax.it
Mon Aug 11 00:51:38 CEST 2003
> As you recommend, I won't modify the default behavior of python.
> But, still I need a better treatment of python on arrays.
Arrays are supplied by extension modules, most popularly Numeric.
If you're doing scientific computations in Python and use arrays but
not Numeric (or its slated-to-be-replacement numarray, of which I
don't know much yet; or the many things layered atop of and onside
of Numeric, such as scipy), switch. You'll be happy you did.
I've never heard a scientific programmer complain too badly about
how Numeric treats arrays, whether they were coming from Fortran
(the typical case), other higher-level languages, or general purpose
languages not really suited for scientific computation (such as C).
You seem to be focused on readable display of arrays (quite an
unusual focus for scientific programming). So, worst case, it's trivial
to write a general purpose function that takes an array of ANY size
and rank and emits it in the way you prefer -- easier than in any
other language commonly used for scientific programming.
So, you don't need anything from Python -- just write that blessed
function and scientifically program to your heart's content.
More information about the Python-list