How to print floating point in scientific format?

Andrew Dalke adalke at mindspring.com
Sat Aug 9 14:59:18 EDT 2003


sdhyok:
> As you may notice, my primary usage of python is for scientific
> programming.
> For the purpose, it is critical for users to flexibly modify the
> printing format
> of floating points depending on their ranges and precisions.

Python gives complete control over you can represent numbers.
It just doesn't change the default representation.  Users *can*
flexibly modify the printing format.

I can't see why you would want to change it globally.  That
just sounds wrong.  Eg, I want my app to print the resolution
in Angstroms in the form "%3.2f" while I want the mass values
in "%3.1f".  A global setting is a very clumsy way to change that.

> This limitation can be a serious handicap in the application of python
> for scientific programming.
> I like to listen to all of you who are interested in this issue.

I do scientific programming.  The lack of specialized formatting
hasn't bothered me at all.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list