mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
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.
This commit is contained in:
parent
2397dd58b7
commit
27bbca6f79
5 changed files with 104 additions and 1 deletions
|
@ -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__},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue