As discussed on python-dev, changed builtin.zip() to handle zero arguments

by returning an empty list instead of raising a TypeError.
This commit is contained in:
Raymond Hettinger 2003-08-02 07:42:57 +00:00
parent 9463792c68
commit eaef615116
5 changed files with 20 additions and 11 deletions

View file

@ -1916,11 +1916,9 @@ builtin_zip(PyObject *self, PyObject *args)
PyObject *itlist; /* tuple of iterators */
int len; /* guess at result length */
if (itemsize < 1) {
PyErr_SetString(PyExc_TypeError,
"zip() requires at least one sequence");
return NULL;
}
if (itemsize == 0)
return PyList_New(0);
/* args must be a tuple */
assert(PyTuple_Check(args));