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


Groups > comp.lang.python > #7427

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

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Unsupported operand type(s) for +: 'float' and 'tuple'
Date 2011-06-10 21:44 -0400
References <af752c9e-e949-4bec-a127-05a3fe500cbf@y30g2000yqb.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.121.1307756700.11593.python-list@python.org> (permalink)

Show all headers | View raw


On 6/10/2011 6: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:

[snip about 100 lines]

Before posting code that does not work, it is a good idea to reduce to 
to some minimum needed to exhibit the problem. If you had done that, you 
may well have found the answer.

In this specific case, you should have searched for all lines making 
assignments to the names causing a problem. This is easier to do by eye 
with a minimal example. Or, use a search function for 'T0 =' (or 'T0=' 
if needed, but it is not) with Find Next and the second hit is the 
offending line ("T0 = initCost*0,1").

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious 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