/external/python/cpython3/Objects/clinic/ |
D | listobject.c.h | 128 list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse); 136 PyObject *keyfunc = Py_None; in list_sort() local 140 &keyfunc, &reverse)) { in list_sort() 143 return_value = list_sort_impl(self, keyfunc, reverse); in list_sort()
|
/external/python/cpython2/Python/ |
D | bltinmodule.c | 1360 PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; in min_max() local 1369 keyfunc = PyDict_GetItemString(kwds, "key"); in min_max() 1370 if (PyDict_Size(kwds)!=1 || keyfunc == NULL) { in min_max() 1375 Py_INCREF(keyfunc); in min_max() 1380 Py_XDECREF(keyfunc); in min_max() 1388 if (keyfunc != NULL) { in min_max() 1389 val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); in min_max() 1431 Py_XDECREF(keyfunc); in min_max() 1442 Py_XDECREF(keyfunc); in min_max() 2230 PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs; in builtin_sorted() local [all …]
|
/external/python/cpython2/Lib/test/ |
D | test_itertools.py | 527 def keyfunc(obj): function 528 if keyfunc.skip > 0: 529 keyfunc.skip -= 1 535 keyfunc.skip = 0 536 self.assertRaises(ExpectedError, gulp, [None], keyfunc) 537 keyfunc.skip = 1 538 self.assertRaises(ExpectedError, gulp, [None, None], keyfunc) 1181 keyfunc = lambda x: x function 1182 for i, j in groupby(xrange(n), key=keyfunc): 1183 keyfunc.__dict__.setdefault('x',[]).append(j)
|
/external/python/cpython2/Modules/ |
D | itertoolsmodule.c | 15 PyObject *keyfunc; member 29 PyObject *it, *keyfunc = Py_None; in groupby_new() local 32 &it, &keyfunc)) in groupby_new() 41 gbo->keyfunc = keyfunc; in groupby_new() 42 Py_INCREF(keyfunc); in groupby_new() 56 Py_XDECREF(gbo->keyfunc); in groupby_dealloc() 67 Py_VISIT(gbo->keyfunc); in groupby_traverse() 83 if (gbo->keyfunc == Py_None) { in groupby_step() 87 newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); in groupby_step()
|
/external/python/cpython3/Modules/ |
D | itertoolsmodule.c | 16 PyObject *keyfunc; member 31 PyObject *it, *keyfunc = Py_None; in groupby_new() local 34 &it, &keyfunc)) in groupby_new() 43 gbo->keyfunc = keyfunc; in groupby_new() 44 Py_INCREF(keyfunc); in groupby_new() 58 Py_XDECREF(gbo->keyfunc); in groupby_dealloc() 69 Py_VISIT(gbo->keyfunc); in groupby_traverse() 85 if (gbo->keyfunc == Py_None) { in groupby_step() 89 newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL); in groupby_step() 149 lz->it, lz->keyfunc, lz->currkey, lz->currvalue, lz->tgtkey); in groupby_reduce() [all …]
|
/external/python/cpython2/Objects/ |
D | listobject.c | 2056 PyObject *keyfunc = NULL; in listsort() local 2065 kwlist, &compare, &keyfunc, &reverse)) in listsort() 2073 if (keyfunc == Py_None) in listsort() 2074 keyfunc = NULL; in listsort() 2075 if (compare != NULL && keyfunc != NULL) { in listsort() 2094 if (keyfunc != NULL) { in listsort() 2097 key = PyObject_CallFunctionObjArgs(keyfunc, value, in listsort() 2172 if (keyfunc != NULL) { in listsort()
|
/external/python/cpython2/Doc/library/ |
D | itertools.rst | 54 :func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v) 311 data = sorted(data, key=keyfunc) 312 for k, g in groupby(data, keyfunc): 324 self.keyfunc = key 332 self.currkey = self.keyfunc(self.currvalue) 339 self.currkey = self.keyfunc(self.currvalue)
|
/external/python/cpython3/Lib/test/ |
D | test_itertools.py | 816 def keyfunc(obj): function 817 if keyfunc.skip > 0: 818 keyfunc.skip -= 1 824 keyfunc.skip = 0 825 self.assertRaises(ExpectedError, gulp, [None], keyfunc) 826 keyfunc.skip = 1 827 self.assertRaises(ExpectedError, gulp, [None, None], keyfunc) 1705 keyfunc = lambda x: x function 1706 for i, j in groupby(range(n), key=keyfunc): 1707 keyfunc.__dict__.setdefault('x',[]).append(j)
|
/external/python/cpython3/Doc/library/ |
D | itertools.rst | 385 data = sorted(data, key=keyfunc) 386 for k, g in groupby(data, keyfunc): 398 self.keyfunc = key 407 self.currkey = self.keyfunc(self.currvalue) 417 self.currkey = self.keyfunc(self.currvalue)
|
D | functions.rst | 881 such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and 882 ``heapq.nlargest(1, iterable, key=keyfunc)``. 915 such as ``sorted(iterable, key=keyfunc)[0]`` and ``heapq.nsmallest(1, 916 iterable, key=keyfunc)``.
|
/external/python/cpython3/Python/ |
D | bltinmodule.c | 1619 PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; in min_max() local 1636 kwlist, &keyfunc, &defaultval); in min_max() 1657 if (keyfunc != NULL) { in min_max() 1658 val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); in min_max()
|
/external/python/cpython3/Objects/ |
D | listobject.c | 2152 list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse) in list_sort_impl() argument 2168 if (keyfunc == Py_None) in list_sort_impl() 2169 keyfunc = NULL; in list_sort_impl() 2183 if (keyfunc == NULL) { in list_sort_impl() 2201 keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i], in list_sort_impl()
|
/external/python/cpython3/Lib/ |
D | pydoc.py | 224 keyfunc = lambda attr: (field_order.get(attr[0], 0), attr[0]) function 225 attrs.sort(key=keyfunc)
|