mirror of https://github.com/python/cpython
Merge heads
This commit is contained in:
commit
79a11e71c6
|
@ -498,11 +498,14 @@ are always available. They are listed here in alphabetical order.
|
|||
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)``.
|
||||
The default *format_spec* is an empty string which usually gives the same
|
||||
effect as calling ``str(value)``.
|
||||
|
||||
A call to ``format(value, format_spec)`` is translated to
|
||||
``type(value).__format__(format_spec)`` which bypasses the instance
|
||||
dictionary when searching for the value's :meth:`__format__` method. A
|
||||
:exc:`TypeError` exception is raised if the method is not found or if either
|
||||
the *format_spec* or the return value are not strings.
|
||||
|
||||
.. function:: frozenset([iterable])
|
||||
:noindex:
|
||||
|
|
Loading…
Reference in New Issue