PEP proposal for round(x,n) enhancement

Chris Barker chrishbarker at
Wed Sep 12 20:19:33 CEST 2001

Christopher Smith wrote:

> There should be away to say "round to the 3rd digit from the first
> non-zero digit.


> I have checked both the Scientific and Numeric packages.  While they do
> allow for extended sorts of formatting (like Fortran formats, etc...) I do
> not see this sort of functionality built into them.

I suggest you post to the NumPy list about this, for two reasons:

1) There are some sharp people there that could help you come up with a
robust algorithm

2) It would be a whole lot easier to get this added to NumPy or SciPy as
a Ufunc than it will be to get it into Python itself (not that it
shouldn't be there, it should). In fact, you could wite it yourself for

By the way, SciPy is a different and more ambitious project than
Scientific. Check out:


Christopher Barker,
ChrisHBarker at                 ---           ---           --- ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------

More information about the Python-list mailing list