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

Jonathan Fine jfine2358 at gmail.com
Sat Jul 28 04:58:05 EDT 2018


Hi All

I've followed my own advice, earlier in this thread. The newly created
repository https://github.com/jfine2358/py-jfine2358 contains personal
Python code that others might find useful.

And you'll find in it:
===
https://github.com/jfine2358/py-jfine2358/blob/master/jfine2358/itertools.py

def zipclose(*argv, close):
    '''As zip(*argv), but call close before raising StopIteration.

   [snip]'''
===

Given zipclose, we can solve Peter's problem by writing a suitable
close function. And some other problems can be solved, by using a
different close function. Comment on my code at
https://github.com/jfine2358/py-jfine2358/issues (preferred), or on
this thread.

Finally, thank you Peter for another good problem.

-- 
Jonathan


More information about the Python-ideas mailing list