Partially unpacking a sequence

jUrner at arcor.de jUrner at arcor.de
Thu Apr 6 17:50:33 EDT 2006


>> Thank you, everyone, for resolving my question. At one point, while
>> trying to solve the problem, I typed
>>
>>>>> 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. Perhaps a more
>>explicit error message would have helped.


The error message is correct because in y[1, 3] "1, 3" is recognized by
the interpreter 
as tuple. Python goodie or snakebite that is...




More information about the Python-list mailing list