summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2010-11-04 17:06:58 (GMT)
committerEric Smith <eric@trueblade.com>2010-11-04 17:06:58 (GMT)
commit27bbca6f79690472c7beff8020ff331b14450b77 (patch)
tree3b6ea39069caf2f197656092c45e9cba0b384b85 /Doc
parent2397dd58b70986db898f689fe7a1597cdd51f29f (diff)
downloadcpython-27bbca6f79690472c7beff8020ff331b14450b77.zip
cpython-27bbca6f79690472c7beff8020ff331b14450b77.tar.gz
cpython-27bbca6f79690472c7beff8020ff331b14450b77.tar.bz2
Issue #6081: Add str.format_map. str.format_map(mapping) is similar to str.format(**mapping), except mapping does not get converted to a dict.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/stdtypes.rst8
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index e75cfc7..0a3ba99 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -1038,6 +1038,14 @@ functions based on regular expressions.
that can be specified in format strings.
+.. method:: str.format_map(mapping)
+
+ Similar to ``str.forrmat(**mapping)``, except that ``mapping`` is
+ used directly and not copied to a :class:`dict` . This is useful
+ if for example ``mapping`` is a dict subclass.
+
+ .. versionadded:: 3.2
+
.. method:: str.index(sub[, start[, end]])
Like :meth:`find`, but raise :exc:`ValueError` when the substring is not found.