This idea is something I could have used many times. I agree with many people here that the strict=True API is at least "unusual" in Python. I was thinking of 2 different API approaches that could be used for this and I think no one has mentioned:




On Mon, 20 Apr 2020 at 18:44, Ram Rachum <ram@rachum.com> 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/