Serhiy Storchaka | 1009bf1 | 2015-04-03 23:53:51 +0300 | [diff] [blame^] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_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 | |
| 14 | static PyObject * |
| 15 | dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value); |
| 16 | |
| 17 | static PyObject * |
| 18 | dict_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 | |
| 30 | exit: |
| 31 | return return_value; |
| 32 | } |
| 33 | |
| 34 | PyDoc_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]*/ |