diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-19 02:17:09 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-19 02:17:09 (GMT) |
commit | 15a4950da1a80b334ee4985c62e66a1e1071a951 (patch) | |
tree | f4038ec0edc4fa562dd334b4a9b1b244dc24dd21 /Modules/itertoolsmodule.c | |
parent | bc670849405d9bda3bbf6f1d28a252abe778bdd9 (diff) | |
download | cpython-15a4950da1a80b334ee4985c62e66a1e1071a951.zip cpython-15a4950da1a80b334ee4985c62e66a1e1071a951.tar.gz cpython-15a4950da1a80b334ee4985c62e66a1e1071a951.tar.bz2 |
Add keyword arg support to itertools.compress().
Diffstat (limited to 'Modules/itertoolsmodule.c')
-rw-r--r-- | Modules/itertoolsmodule.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c index 3eb760b..e2ca9c7 100644 --- a/Modules/itertoolsmodule.c +++ b/Modules/itertoolsmodule.c @@ -2607,11 +2607,9 @@ compress_new(PyTypeObject *type, PyObject *args, PyObject *kwds) PyObject *seq1, *seq2; PyObject *data=NULL, *selectors=NULL; compressobject *lz; - - if (type == &compress_type && !_PyArg_NoKeywords("compress()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "compress", 2, 2, &seq1, &seq2)) + static char *kwargs[] = {"data", "selectors", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:compress", kwargs, &seq1, &seq2)) return NULL; data = PyObject_GetIter(seq1); @@ -2689,7 +2687,7 @@ compress_next(compressobject *lz) } PyDoc_STRVAR(compress_doc, -"compress(data sequence, selector sequence) --> iterator over selected data\n\ +"compress(data, selectors) --> iterator over selected data\n\ \n\ Return data elements corresponding to true selector elements.\n\ Forms a shorter iterator from selected data elements using the\n\ |