Re: listcomprehension, add elements?

2008-06-23 Thread Boris Borcic
John Machin wrote: Instead of sum(a + b for a, b in zip(foo, bar)) why not use sum(foo) + sum(bar) ? or even sum(foo+bar) as may apply. Cheers, BB -- http://mail.python.org/mailman/listinfo/python-list

Re: listcomprehension, add elements?

2008-06-23 Thread Maric Michaud
Le Monday 23 June 2008 11:39:44 Boris Borcic, vous avez écrit : John Machin wrote: Instead of sum(a + b for a, b in zip(foo, bar)) why not use sum(foo) + sum(bar) ? or even sum(foo+bar) as may apply. Because some are better than others : sum(foo+bar) is the worst, it create a

Re: listcomprehension, add elements?

2008-06-23 Thread John Machin
On Jun 23, 9:16 pm, Maric Michaud [EMAIL PROTECTED] wrote: Le Monday 23 June 2008 11:39:44 Boris Borcic, vous avez écrit : John Machin wrote: Instead of sum(a + b for a, b in zip(foo, bar)) why not use sum(foo) + sum(bar) ? or even sum(foo+bar) as may apply. Because some are

Re: listcomprehension, add elements?

2008-06-23 Thread Maric Michaud
Le Monday 23 June 2008 13:51:34 John Machin, vous avez écrit : On Jun 23, 9:16 pm, Maric Michaud [EMAIL PROTECTED] wrote: Le Monday 23 June 2008 11:39:44 Boris Borcic, vous avez écrit : John Machin wrote: Instead of sum(a + b for a, b in zip(foo, bar)) why not use sum(foo) + sum(bar)

listcomprehension, add elements?

2008-06-22 Thread cirfu
[a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51] i want to add all the elemtns a s well. can

Re: listcomprehension, add elements?

2008-06-22 Thread Jeff
On Jun 22, 6:32 pm, cirfu [EMAIL PROTECTED] wrote: [a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,

Re: listcomprehension, add elements?

2008-06-22 Thread Paul Hankin
On Jun 23, 10:32 am, cirfu [EMAIL PROTECTED] wrote: [a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,

Re: listcomprehension, add elements?

2008-06-22 Thread John Machin
On Jun 23, 9:23 am, Paul Hankin [EMAIL PROTECTED] wrote: On Jun 23, 10:32 am, cirfu [EMAIL PROTECTED] wrote: [a+b for a,b in zip(xrange(1,51), xrange(50,0,-1))] [51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51,