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


Groups > comp.lang.python > #85451

Re: TypeError: list indices must be integers, not tuple

Date 2015-02-10 10:51 -0500
From Dave Angel <davea@davea.name>
Subject Re: TypeError: list indices must be integers, not tuple
References <dcae1673-8fe1-4734-90ce-682b8d4e6063@googlegroups.com> <CAM8kh5sJ4Hiu08pn5xcLP1SQm2rpy+dvtUZWU9LGaYQfh4RdFQ@mail.gmail.com> <mbcqe1$7ik$1@ger.gmane.org> <54DA1573.1030804@davea.name> <CAPTjJmrvdUwGycjwF0ZQGtE04Vsk2pF81xHqJhTDy9VGcqiFHw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.18612.1423583496.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 02/10/2015 09:33 AM, Chris Angelico wrote:
> On Wed, Feb 11, 2015 at 1:28 AM, Dave Angel <davea@davea.name> wrote:
>>> If you can show me a one tuple anywhere in the original code I'll
>>> happily buy you a tipple of your choice.
>>
>>
>> print Menu[fav,RandomNum]
>>
>> was in the original code
>
> That's not a one-tuple (as in, a tuple with one element), it's a
> two-element tuple. The point is that ("3") doesn't create a tuple,
> it's just superfluous parentheses.

You're right of course. I didn't notice the meaning of one-tuple; I took 
Mark's comment as if he had said:

If you can show me a <rubout><rubout> one tuple anywhere ...

The original error message said there was a tuple;  I knew that fav 
wasn't the tuple, but the combination of fav and RandomNum was.


-- 
DaveA

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


Thread

TypeError: list indices must be integers, not tuple james8booker@hotmail.com - 2015-02-09 15:52 -0800
  Re: TypeError: list indices must be integers, not tuple Ethan Furman <ethan@stoneleaf.us> - 2015-02-09 16:02 -0800
  Re: TypeError: list indices must be integers, not tuple Dave Angel <davea@davea.name> - 2015-02-09 22:05 -0500
  Re: TypeError: list indices must be integers, not tuple Dave Angel <davea@davea.name> - 2015-02-09 23:48 -0500
  Re: TypeError: list indices must be integers, not tuple Terry Reedy <tjreedy@udel.edu> - 2015-02-10 00:57 -0500
  Re: TypeError: list indices must be integers, not tuple Ryan Stuart <ryan.stuart.85@gmail.com> - 2015-02-10 00:05 +0000
  Re: TypeError: list indices must be integers, not tuple Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-10 11:35 +0000
  Re: TypeError: list indices must be integers, not tuple Dave Angel <davea@davea.name> - 2015-02-10 09:28 -0500
  Re: TypeError: list indices must be integers, not tuple Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-02-10 14:32 +0000
  Re: TypeError: list indices must be integers, not tuple Chris Angelico <rosuav@gmail.com> - 2015-02-11 01:33 +1100
  Re: TypeError: list indices must be integers, not tuple Dave Angel <davea@davea.name> - 2015-02-10 10:51 -0500
  Re: TypeError: list indices must be integers, not tuple Chris Angelico <rosuav@gmail.com> - 2015-02-11 05:48 +1100
  Re: TypeError: list indices must be integers, not tuple Dave Angel <davea@davea.name> - 2015-02-10 15:38 -0500

csiph-web