blob: 5288b9a8b320c5b173772eb3019456af93dab919 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(dict_fromkeys__doc__,
6"fromkeys($type, iterable, value=None, /)\n"
7"--\n"
8"\n"
9"Returns a new dict with keys from iterable and values equal to value.");
10
11#define DICT_FROMKEYS_METHODDEF \
12 {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS|METH_CLASS, dict_fromkeys__doc__},
13
14static PyObject *
15dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
16
17static PyObject *
18dict_fromkeys(PyTypeObject *type, PyObject *args)
19{
20 PyObject *return_value = NULL;
21 PyObject *iterable;
22 PyObject *value = Py_None;
23
24 if (!PyArg_UnpackTuple(args, "fromkeys",
25 1, 2,
26 &iterable, &value))
27 goto exit;
28 return_value = dict_fromkeys_impl(type, iterable, value);
29
30exit:
31 return return_value;
32}
33
34PyDoc_STRVAR(dict___contains____doc__,
35"__contains__($self, key, /)\n"
36"--\n"
37"\n"
38"True if D has a key k, else False.");
39
40#define DICT___CONTAINS___METHODDEF \
41 {"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
42/*[clinic end generated code: output=fe74d676332fdba6 input=a9049054013a1b77]*/