On Fri, 15 May 2020 at 21:50, Eric V. Smith <eric@trueblade.com> wrote:
I fear that my comment on some text in the PEP was lost amidst the
voting, so I'm repeating it here. This will probably screw up some
threading, but this is the oldest message I have to reply to.

The PEP says "At most one additional item may be consumed from one of
the iterators when compared to normal zip usage." I think this should be
prefaced with "If ValueError is raised ...". Also, why does it say "at
most one additional item". How could it ever be less than one?

It seems to me, looking at the Python implementation in the PEP (not the current or C implementation) that the crux is here:

except StopIteration:
        if not strict:
 if items:
        i = len(items) + 1
        raise ValueError(f"zip() argument {i} is too short")
So if it is not strict, it will return/stop consuming iterators. If it is strict but it runs out *not* on the first iterator it will also not consume from another iterator?

And I'm not sure I'd say "normal zip usage", maybe "the existing builtin
zip function".

Depends on where we end up I guess, if we go with what Brandt' PEP says (makes sense to keep internally consistent) I'd say "zip without the strict=True flag" or similar.

Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/ZEY2QHBSILZZHL7ISYZTHC4KHJ4JTBI7/
Code of Conduct: http://python.org/psf/codeofconduct/