Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30762

Re: sum function

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mike20007@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'attribute': 0.05; 'none)': 0.07; 'imported': 0.09; 'nameerror:': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'col': 0.16; 'functools': 0.16; 'wrote:': 0.17; 'module': 0.19; 'import': 0.21; 'defined': 0.22; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(most': 0.27; 'cc:addr:gmail.com': 0.27; 'mike': 0.27; 'cc:2**2': 0.27; 'library.': 0.27; 'thursday,': 0.30; 'error': 0.30; 'file': 0.32; 'traceback': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'cc:no real name:2**1': 0.36; 'october': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'total': 0.65; 'angel': 0.93
Newsgroups comp.lang.python
Date Thu, 4 Oct 2012 17:40:49 -0700 (PDT)
In-Reply-To <mailman.1813.1349386825.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=209.214.209.61; posting-account=7tqB8QoAAAA7bxs1K8Gn7hSbQPXdDOzg
References <7c7beccb-72e4-4cfb-958d-4a7235076fb3@googlegroups.com> <CALwzidnEKReQiHNEHekFByxEENQbvOHff8L=AOk2Hir7J1dN4g@mail.gmail.com> <mailman.1810.1349384780.27098.python-list@python.org> <307d5843-af17-4079-8a48-f8d7351a1d7b@googlegroups.com> <mailman.1813.1349386825.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 209.214.209.61
MIME-Version 1.0
Subject Re: sum function
From Mike <mike20007@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org, d@davea.name, Mike <mike20007@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.1821.1349397657.27098.python-list@python.org> (permalink)
Lines 42
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349397657 news.xs4all.nl 6870 [2001:888:2000:d::a6]:34527
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30762

Show key headers only | View raw


On Thursday, October 4, 2012 5:40:26 PM UTC-4, Dave Angel wrote:
> On 10/04/2012 05:29 PM, Mike wrote:
> 
> > I get below error
> 
> >
> 
> > NameError: name 'functools' is not defined
> 
> >
> 
> 
> 
> functools is a module in the standard library. You need to import it.
> 
> 
> 
> import functools
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> 
> 
> DaveA

I imported functools. Now I get the below error please.


Traceback (most recent call last):
  File "test.py", line 16, in <module>
    total = sum(float(col.value) for r in iter(next_r, None) for col in r.itervalues()) 
  File "test.py", line 16, in <genexpr>
    total = sum(float(col.value) for r in iter(next_r, None) for col in r.itervalues()) 
AttributeError: 'list' object has no attribute 'itervalues'

Thanks

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

sum function mike20007@gmail.com - 2012-10-04 13:52 -0700
  Re: sum function Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-04 15:04 -0600
    Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 14:31 -0700
    Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 14:31 -0700
  Re: sum function Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-04 15:05 -0600
    Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 14:29 -0700
      Re: sum function Dave Angel <d@davea.name> - 2012-10-04 17:39 -0400
        Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 17:40 -0700
          Re: sum function Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-04 18:59 -0600
            Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 19:01 -0700
              Re: sum function Ramchandra Apte <maniandram01@gmail.com> - 2012-10-05 01:31 -0700
              Re: sum function Ramchandra Apte <maniandram01@gmail.com> - 2012-10-05 01:31 -0700
            Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 19:01 -0700
        Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 17:40 -0700
      Re: sum function Chris Angelico <rosuav@gmail.com> - 2012-10-05 07:34 +1000
    Re: sum function Mike <mike20007@gmail.com> - 2012-10-04 14:29 -0700
  Re: sum function Mike <mike20007@gmail.com> - 2012-10-05 06:39 -0700
    Re: sum function Ramchandra Apte <maniandram01@gmail.com> - 2012-10-05 06:41 -0700
      Re: sum function Mike <mike20007@gmail.com> - 2012-10-05 06:47 -0700
        Re: sum function Terry Reedy <tjreedy@udel.edu> - 2012-10-05 14:52 -0400
          Re: sum function Mike <mike20007@gmail.com> - 2012-10-05 13:09 -0700
            Re: sum function Dave Angel <d@davea.name> - 2012-10-05 16:26 -0400
              Re: sum function Ramchandra Apte <maniandram01@gmail.com> - 2012-10-06 05:38 -0700
          Re: sum function Mike <mike20007@gmail.com> - 2012-10-05 13:09 -0700
    Re: sum function Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-05 13:29 -0600
  Re: sum function Mike <mike20007@gmail.com> - 2012-10-05 13:03 -0700
    Re: sum function Ian Kelly <ian.g.kelly@gmail.com> - 2012-10-05 14:10 -0600
      Re: sum function Mike <mike20007@gmail.com> - 2012-10-05 14:19 -0700

csiph-web