summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-02-23 10:24:23 (GMT)
committerGeorg Brandl <georg@python.org>2009-02-23 10:24:23 (GMT)
commit528f8810aa495d2efc50af7ceb28d2c7092ea92e (patch)
tree7e0af37ae139cf280d29c1cee9c9a69ea62ddfe7 /Doc/library
parent8ad554fdbea689581f97774acc77e5c15bcac15a (diff)
downloadcpython-528f8810aa495d2efc50af7ceb28d2c7092ea92e.zip
cpython-528f8810aa495d2efc50af7ceb28d2c7092ea92e.tar.gz
cpython-528f8810aa495d2efc50af7ceb28d2c7092ea92e.tar.bz2
#5348: format() converts all kinds of values.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/functions.rst20
1 files changed, 20 insertions, 0 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 3789e20..0232e1b 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -425,6 +425,26 @@ available. They are listed here in alphabetical order.
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: