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

Jonathan Fine jfine2358 at gmail.com
Fri Jul 27 14:54:14 EDT 2018


Hi Peter

Thank you for your deferred default values idea, which we're now
working on together.
https://github.com/petered/peters_example_code/blob/master/peters_example_code/deferral.py

You 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
[function definition snipped]

You need this function wherever you go. You can solve that problem
right now by putting it into PyPI. And if you put it on
github, perhaps someone will fork it and contribute. (Note to self. I
should do the same for my own useful little tools.)

You asked about putting in the standard library. There's a process for that.
https://www.python.org/dev/peps/pep-0001/

You might also want to look at the PEP index, to find a successful PEP
that's similar to yours.
https://www.python.org/dev/peps/

Here's one I've found that looks similar. It proposes the inclusion of
a third-party module, pathlib, in the standard library.
https://www.python.org/dev/peps/pep-0428/

Putting your code into PyPI into PyPI solves your immediate problem.
It also also gives you a reference implementation.
https://www.python.org/dev/peps/pep-0001/#what-belongs-in-a-successful-pep

I hope your next post will be URL for code on github. I'd be
interested in making a fork.

Best wishes

Jonathan


More information about the Python-ideas mailing list