The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.lang.python
From: Ian Kelly <ian.g.ke...@gmail.com>
Date: Thu, 4 Oct 2012 15:04:53 -0600
Local: Thurs, Oct 4 2012 5:04 pm
Subject: Re: sum function
On Thu, Oct 4, 2012 at 2:52 PM, <mike20...@gmail.com> wrote:
scanner = client.scannerOpenWithStop("tab", "10", "1000", ["cf:col1"])
> scanner = client.scannerOpenWithStop("tab", "10", "1000", ["cf:col1"]) > total = 0.0 > r = client.scannerGet(scanner) > while r: > for k in (r[0].columns): > total += float(r[0].columns[k].value) > r = client.scannerGet(scanner) > print total
> Do you know of better (faster) way to do sum?
next_r = itertools.partial(client.scannerGet, scanner) total = sum(float(col.value) for r in iter(next_r, None) for col in r.itervalues()) You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||