summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
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 /Objects/unicodeobject.c
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 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 17dc27e..b67b8f9 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -9028,6 +9028,11 @@ PyDoc_STRVAR(format__doc__,
\n\
");
+PyDoc_STRVAR(format_map__doc__,
+ "S.format_map(mapping) -> str\n\
+\n\
+");
+
static PyObject *
unicode__format__(PyObject* self, PyObject* args)
{
@@ -9109,6 +9114,7 @@ static PyMethodDef unicode_methods[] = {
{"isprintable", (PyCFunction) unicode_isprintable, METH_NOARGS, isprintable__doc__},
{"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__},
{"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__},
+ {"format_map", (PyCFunction) do_string_format_map, METH_O, format_map__doc__},
{"__format__", (PyCFunction) unicode__format__, METH_VARARGS, p_format__doc__},
{"maketrans", (PyCFunction) unicode_maketrans,
METH_VARARGS | METH_STATIC, maketrans__doc__},