[Python-3000] have zip() raise exception for sequences of different lengths

Steven Bethard steven.bethard at gmail.com
Thu Aug 31 05:32:14 CEST 2006


On 8/30/06, Raymond Hettinger <rhettinger at ewtllc.com> wrote:
> >If changing zip()'s behavior to match the most common use case is
> >totally out, the stdlib code at least argues for adding something like
> >itertools.izip_exact().
>
> I open to that.
>
> For this time being, let's do this.  Add itertools.izip_longest() in
> Py2.5 and include a recipe for izip_exact() and see if anyone cares
> enough to ever use it.  The new any() and all() functions started out as
> recipes and graduated when their popularity was shown.  If izip_exact()
> proves its worth, then I would be happy to add it as a tool.

Fair enough.  Michael Chermside provided a recipe here:

http://mail.python.org/pipermail/python-3000/2006-March/000160.html

Maybe there's a cleaner way to write this, but I couldn't spot one off-hand.

STeVe
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy


More information about the Python-3000 mailing list