[Python-3000] Parallel iteration syntax
Guido van Rossum
guido at python.org
Tue Mar 28 21:01:49 CEST 2006
On 3/28/06, Ian Bicking <ianb at colorstudy.com> wrote:
> Guido van Rossum wrote:
> > The proposed syntax doesn't quite jive with my guts, and the issue of
> > "what to do if they are of unequal length" is a good one, which is
> > better solved by being explicit and using zip (== izip).
>
> Is zip() going to be equivalent to izip(), or will it be a view? I vote
> for view. xrange() does not produce an iterator, so there is some
> precedence that we not replace list-constructing-builtins with
> iterator-constructing-builtins.
I believe it should be an interator (i.e. izip()). I think we should
be careful with making everything a view, especially if the *input*
can be an arbitrary iterator. filter(), map(), zip(), enumerate() all
make perfect sense with an iterator as input, and I don't want to
think about the consequences of allowing views on iterators.
I think views should only be used when the view invariants can be
easily sustained by the underlying data type. A dict can be taught
about its views and has complete control because you get the views by
calling a method. That's not the case for zip().
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list