Partially unpacking a sequence

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Thu Apr 6 17:43:12 EDT 2006


tkpmep at hotmail.com enlightened us with:
>>>> y[1,3]
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> TypeError: list indices must be integers
>
> The error message gave me no clue as to what I was doing wrong (in
> my mind, I was just writing out the elements of a range), and I
> thought perhaps that my inclusion of a comma was the problem.

You thought correct. List indices must be integers, not tuples.

> Perhaps a more explicit error message would have helped.

Why? You thought the right thing.

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list