On Apr 20, 2020, at 10:42, Ram Rachum <r...@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.

One quick bikeshedding question (which also gets to the heart of how you’d want 
to implement it); apologies if this came up in the thread from 2 years ago or 
the discussion in the more-iterables PR that I just suggested everyone should 
read before commenting, but I wanted to get this down before I forget it.

    x = iter(range(5))
    y = [0]
    try:
        zipped = zip(x, y, strict=True)
    except ValueError: # assuming that’s the exception you want?
        print(next(x))

Should this print 1 or 2 or raise StopIteration or be a don’t-care?

Should it matter if you zip(y, x, strict=True) instead?

_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@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/3CWTSFTLVGYHWPKMG45N4GZFEV2Z7RZF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to