[Python-checkins] r69896 - python/trunk/Doc/library/functions.rst

georg.brandl python-checkins at python.org
Mon Feb 23 11:24:23 CET 2009


Author: georg.brandl
Date: Mon Feb 23 11:24:23 2009
New Revision: 69896

Log:
#5348: format() converts all kinds of values.

Modified:
   python/trunk/Doc/library/functions.rst

Modified: python/trunk/Doc/library/functions.rst
==============================================================================
--- python/trunk/Doc/library/functions.rst	(original)
+++ python/trunk/Doc/library/functions.rst	Mon Feb 23 11:24:23 2009
@@ -425,6 +425,26 @@
 
    The float type is described in :ref:`typesnumeric`.
 
+
+.. function:: format(value[, format_spec])
+
+   .. index::
+      pair: str; format
+      single: __format__
+
+   Convert a *value* to a "formatted" representation, as controlled by
+   *format_spec*.  The interpretation of *format_spec* will depend on the type
+   of the *value* argument, however there is a standard formatting syntax that
+   is used by most built-in types: :ref:`formatspec`.
+
+   .. note::
+
+      ``format(value, format_spec)`` merely calls
+      ``value.__format__(format_spec)``.
+
+   .. versionadded:: 2.6
+
+
 .. function:: frozenset([iterable])
    :noindex:
 


More information about the Python-checkins mailing list