Dominik Vilsmeier writes:
> Or simply "samelength".
If we're going to do this to the builtin (I'm still -1 on changing the
builtin FWIW), I'm persuaded by Chris Barkley's (somewhat different)
argument that we may as well combine all the functionality in the
builtin. How about
zip(*iterables, length="shortest") # "shortest" is default
zip(*iterables, length="longest", fill=None) # None is default
zip(*iterables, length="checksame") # or just "same" or "checkequal" etc
As the odd suggested value "checksame" shows, I see these semantics as
not exactly congruent. But I think the argument name "length"
addresses the concern about the ambiguity of various argument names.
I think it would be pretty nice to write:
zip.shortest(...) # same as zip(...)
This would autocomplete nicely and be similar to using enums.
The PEP seems to reject this saying:
The actual zip type is an undocumented implementation detail. Adding additional methods or constructors is really a much larger change that is not necessary to achieve the stated goal.
But `zip.longest(...)` doesn't strictly require that `zip` is a class, so other implementations can still provide this API in different ways. And I'm not clear on what the point of the second sentence is. Having these alternative 'methods' would be similar to having different functions in itertools, and it's really just syntactic sugar for a string argument.
Other than that though, I think your variant of the proposal is best, including all the names.