"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> def number_format(num, places=0):
> """Format a number according to locality and given places"""
> locale.setlocale(locale.LC_ALL, "")
> return locale.format("%.*f", (places, num), True)
>
There are some edge cases in the format conversion that could present
some issues. For example:
>>> print number_format( 2312753.44500000, 2 )
2,312,753.44
>>> print number_format( 2312753.44500001, 2 )
2,312,753.45
I would expect the first to produce the same results as the second, but,
I suppose because of one of floating point's features, it doesn't work
that way.
--
rzed
--
http://mail.python.org/mailman/listinfo/python-list