On 4/21/2020 10:14 AM, Eric V. Smith wrote:
On 4/21/2020 10:10 AM, Soni L. wrote:
I feel like zip could return partial results:

try:
  next(zip([0], []))
except StopIteration as exc:
  assert StopIteration.args == (0,)

how much would this break?

It would break a lot of code, and so it won't happen.
Actually, I'm not so sure of that, presuming you mean "exc.args", not "StopIteration.args". And since that's currently set to "()", at least in my tests, maybe setting it wouldn't break much code. But it's probably a non-zero amount.

You can use itertools.zip_longest with your own sentinel to get the same behavior.

In your proposal, what would next(zip([0], [], [0])) result in?

This point still stands.
_______________________________________________
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/BBDE2XE57JZOKT55WECYWYZCW7JLIWAN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to