Graham Barr wrote:

> > The upcoming Python (v2.0) introduces a builtin called zip() that does
> > the same thing:
> >
> >   for a,b,c in zip(aa,bb,cc):
> >       ...
> >
> > There are also question on how long the resulting list should be if
> > @a, @b, @c is not of the same length.  I think zip() was defined to
> > stop when the first list runs out.
>
> I am sure that will be a debate. My first thought was to continue for the
> longest and return undef's for the others. I am sure someone would suggest
> use aa other cc and many more.
>
> If this is implemented someone will just have to decide what make most sense
> and implement that.

stopping at the shortest doesn't permit useful operations on the remainder of the
longer list entries.

Stopping at the longest with undef's seems more general, and people who want the
shorter could

for $a, $b, $c in zip (@aa, @bb, @cc)
{
   last if ! defined $a  ||  ! defined $b  ||  ! defined $c;
}
--
Glenn
=====
There  are two kinds of people, those
who finish  what they start,  and  so
on...                 -- Robert Byrne


_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html

Reply via email to