+1. I implemented my own zip (because exceptions[1]) and it's so easy to accidentally have length-related bugs everywhere because your tests are just stopping short with no error.

[1] https://creationix.github.io/http-clone/?https://soniex2.autistic.space/git-repos/abdl.git#cbdcd9dd71f3215520b40b0454cd21c03101bd33

On 2020-04-20 2:42 p.m., Ram Rachum wrote:
Here's something that would have saved me some debugging yesterday:

    >>> zipped = zip(x, y, z, strict=True)

I suggest that `strict=True` would ensure that all the iterables have been exhausted, raising an exception otherwise.

This is useful in cases where you're assuming that the iterables all have the same lengths. When your assumption is wrong, you currently just get a shorter result, and it could take you a while to figure out why it's happening. 

What do you think? 

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6GFUADSQ5JTF7W7OGWF7XF2NH2XUTUQM/
Code of Conduct: http://python.org/psf/codeofconduct/