error converting list to tuple
Stefan Seefeld
seefeld at sympatico.ca
Tue May 18 11:31:24 EDT 2004
john fabiani wrote:
> Stefan Seefeld wrote:
>
>> hi there,
>>
>> I'm trying to convert a tuple to a list,
>> and get a 'TypeError: list objects are unhashable'.
>>
>> Can anybody enlighten me as to the possible causes
>> for this ? Where does hashing come into play during
>> this conversion ?
>>
>> Could it be that my runtime is corrupted ?
>> The code is executed from within a C++ extension
>> module I'm developing...
>>
>> Thanks for any help,
>> Stefan
>>
>> PS: I'm using python 2.3.3 in case that matters
>>
>>
> God I can't believe I think I can answer this question:
well, unfortunately that wasn't my question <wink/>
I do:
t = ('hello',)
l = list(t)
which is the standard tuple->list conversion. And yes,
it does work when I run that code in isolation.
The point is that the above, as simple as it looks,
fails with said exception in a very specific context
(I call this code from within a C++ extension module),
so I'm wondering whether I could have messed up the
python runtime somehow or whether there are other
possible explanations for the exception.
Regards,
Stefan
More information about the Python-list
mailing list