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


Groups > comp.lang.python > #7375

Re: Unsupported operand type(s) for +: 'float' and 'tuple'

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.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; 'python.': 0.04; 'python': 0.08; 'tuple': 0.09; 'error:': 0.12; 'am,': 0.14; 'wrote:': 0.14; '-tkc': 0.16; 'comma.': 0.16; 'francesc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 0.16; 'float': 0.16; "subject:' ": 0.16; 'traceback': 0.16; '(most': 0.16; "wouldn't": 0.17; 'cc:addr :python-list': 0.17; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'last):': 0.23; "doesn't": 0.25; 'values': 0.25; "i'm": 0.27; 'instead': 0.29; 'all,': 0.30; 'cc:addr:python.org': 0.30; 'operand': 0.30; 'typeerror:': 0.30; 'file': 0.34; 'header:User-Agent:1': 0.35; 'skip:" 10': 0.35; 'here,': 0.35; 'setting': 0.36; 'problems': 0.36; 'two': 0.37; 'think': 0.38; 'subject:: ': 0.38; 'received:209': 0.39; 'either': 0.39; 'add': 0.39; 'period': 0.64; '05:30': 0.84; 'summing': 0.84; 'type(s)': 0.91
Date Fri, 10 Jun 2011 06:38:48 -0500
From Tim Chase <python.list@tim.thechases.com>
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version 1.0
To Francesc Segura <frsegrev@gmail.com>
Subject Re: Unsupported operand type(s) for +: 'float' and 'tuple'
References <af752c9e-e949-4bec-a127-05a3fe500cbf@y30g2000yqb.googlegroups.com>
In-Reply-To <af752c9e-e949-4bec-a127-05a3fe500cbf@y30g2000yqb.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
X-Source
X-Source-Args
X-Source-Dir
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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>
Newsgroups comp.lang.python
Message-ID <mailman.82.1307705938.11593.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 82.94.164.166
X-Trace 1307705938 news.xs4all.nl 49180 [::ffff:82.94.164.166]:50342
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7375

Show key headers only | View raw


On 06/10/2011 05:30 AM, Francesc Segura wrote:
> Hello all, I'm new to this and I'm having problems on summing two
> values at python.
>
> I get the following error:
>
> Traceback (most recent call last):
>    File "C:\edge-bc (2).py", line 168, in<module>
>      if (costGG<= cost + T0):
> TypeError: unsupported operand type(s) for +: 'float' and 'tuple'
>
> I'm working with networkx and my program is this one:
...
> T0 = initCost*0,1

Here, you're setting T0 to the tuple "(initCost*0, 1)" == "(0, 
1)".  I think you mean to use a period instead of a comma.

You then try to add that to a float (cost), and Python doesn't 
like that.  I wouldn't either :)

-tkc

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


Thread

Unsupported operand type(s) for +: 'float' and 'tuple' Francesc Segura <frsegrev@gmail.com> - 2011-06-10 03:30 -0700
  Re: Unsupported operand type(s) for +: 'float' and 'tuple' Tim Chase <python.list@tim.thechases.com> - 2011-06-10 06:38 -0500
    Re: Unsupported operand type(s) for +: 'float' and 'tuple' Francesc Segura <frsegrev@gmail.com> - 2011-06-10 05:12 -0700
  Re: Unsupported operand type(s) for +: 'float' and 'tuple' "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-06-10 22:02 -0300
  Re: Unsupported operand type(s) for +: 'float' and 'tuple' "Gabriel Genellina" <gagsl-py2@yahoo.com.ar> - 2011-06-10 22:02 -0300
    Re: Unsupported operand type(s) for +: 'float' and 'tuple' Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-06-12 19:23 +0200
  Re: Unsupported operand type(s) for +: 'float' and 'tuple' Terry Reedy <tjreedy@udel.edu> - 2011-06-10 21:44 -0400

csiph-web