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

@ -1126,7 +1126,8 @@ class BuiltinTest(unittest.TestCase):
if i < 0 or i > 2: raise IndexError
return i + 4
self.assertEqual(zip(a, I()), t)
self.assertRaises(TypeError, zip)
self.assertEqual(zip(), [])
self.assertEqual(zip(*[]), [])
self.assertRaises(TypeError, zip, None)
class G:
pass