From eaef61511656071194565878dc80c46096d46415 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sat, 2 Aug 2003 07:42:57 +0000 Subject: As discussed on python-dev, changed builtin.zip() to handle zero arguments by returning an empty list instead of raising a TypeError. --- Python/bltinmodule.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 49fcc09cfc..fb92478ac2 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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)); -- cgit v1.2.1