Merged revisions 63655 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63655 | benjamin.peterson | 2008-05-25 19:54:22 -0500 (Sun, 25 May 2008) | 2 lines

  update the tutorial to use str.format
........
This commit is contained in:
Benjamin Peterson 2008-05-26 01:03:56 +00:00
parent dc6c16ac63
commit e6f00637be
7 changed files with 84 additions and 34 deletions

View file

@ -132,9 +132,8 @@ that every float operation can suffer a new rounding error.
While pathological cases do exist, for most casual use of floating-point
arithmetic you'll see the result you expect in the end if you simply round the
display of your final results to the number of decimal digits you expect.
:func:`str` usually suffices, and for finer control see the discussion of
Python's ``%`` format operator: the ``%g``, ``%f`` and ``%e`` format codes
supply flexible and easy ways to round float results for display.
:func:`str` usually suffices, and for finer control see the :meth:`str.format`
method's format specifiers in :ref:`formatstrings`.
If you are a heavy user of floating point operations you should take a look
at the Numerical Python package and many other packages for mathematical and