[Python-ideas] Can we add "zip and assert equal length" to the standard library?

Steven D'Aprano steve at pearwood.info
Fri Jul 27 19:27:32 EDT 2018


On Fri, Jul 27, 2018 at 07:02:37PM +0200, Peter O'Connor wrote:

> I find that about 90% of the time I want want to zip iterators together, I
> expect them to be the same length and want to throw an exception if they
> aren't.  Yet there is not currently a solution for this in the standard
> library for this, and as a result I always have to take this function
> everywhere I go:
[snip]

Indeed. The need is real, and the question has come up many times on 
Python-List as well.


> Would anybody object to adding this to the standard library for Python 3.8?

Given that the obvious place to put it is itertools, the person you need 
to convince is Raymond Hettinger.


-- 
Steve


More information about the Python-ideas mailing list