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
- Re: Reduce [was: Re: Random items (old p5p issues)] Graham Barr
- Re: Reduce [was: Re: Random items (old p5p issue... John Porter
- Re: Reduce [was: Re: Random items (old p5p i... Graham Barr
- Expanding the language primitives (was: ... Dan Sugalski
- Re: Expanding the language primitives (w... Johan Vromans
- Re: Expanding the language primitives (w... Dan Sugalski
- Re: Reduce [was: Re: Random items (old p5p i... Tom Christiansen
- Re: Reduce [was: Re: Random items (old p... Graham Barr
- Re: Reduce [was: Re: Random items (old p... Hildo Biersma
- Re: Reduce [was: Re: Random items (old p5p i... Simon Cozens
- Re: Reduce [was: Re: Random items (old p5p issue... Glenn Linderman
- Re: Reduce [was: Re: Random items (old p5p issues)] Tom Hughes
- Re: Reduce [was: Re: Random items (old p5p issue... Graham Barr
- Re: Reduce [was: Re: Random items (old p5p i... John Porter
- Re: Reduce [was: Re: Random items (old p5p i... Tom Hughes
- List operations (interleave etc) -- RFRFC skud
- Re: Reduce [was: Re: Random items (old p5p issues)] Martyn J. Pearce
- Re: Reduce [was: Re: Random items (old p5p issues)] Graham Barr
- Re: Reduce [was: Re: Random items (old p5p issue... Jeremy Howard
- Re: Contexts [was:Reduce[Re:]] raptor
- Re: Contexts [was:Reduce[Re:]] Piers Cawley