tuples vs lists

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Jan 10 15:49:39 EST 2005


Antoon Pardon a écrit :
> Op 2005-01-08, Bruno Desthuilliers schreef <bdesth.quelquechose at free.quelquepart.fr>:
> 
>>worzel a écrit :
>>
>>>I get what the difference is between a tuple and a list, but why would I 
>>>ever care about the tuple's immuutability?
>>
>>Because, from a purely pratical POV, only an immutable object can be 
>>used as kay in a dict.

<my-bad> s/kay/key/ </my-bad>

> This is not true.

Chapter and verse, please ?

> 
>>So you can use tuples for 'composed key'. 
> 
> lists can be so used too. Just provide a hash.

Please show us an example, and let's see how useful and handy this is 
from a "purely practical POV" ?-)

Bruno



More information about the Python-list mailing list