> Steven Bethard wrote:
> >A couple Python-3000 threads [1] [2] have indicated that the most
> >natural use of zip() is with sequences of the same lengths.  I feel
> >the same way, and run into this all the time.  Because the error would
> >otherwise pass silently, I usually end up adding checks before each
> >use of zip() to raise an exception if I accidentally pass in sequences
> >of different lengths.
> >
> >Any chance that zip() in Python 3000 could automatically raise an
> >exception if the sequence lengths are different?  If there's really a
> >need for a zip that just truncates, maybe that could be moved to
> >itertools?  I think the equal-length scenario is dramatically more
> >common, and keeping that error from passing silently would be a good
> >thing IMHO.

[Raymond]
> -1
>  I think this would cause much more harm than good and wreck an
> otherwise easy-to-understand tool.

Perhaps a compromise could be to add a keyword parameter to request
such an exception? (We could even add three options: truncate, pad,
error, with truncate being the default, and pad being the old map()
and filter() behavior.)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to