tuples vs lists

Antoon Pardon apardon at forel.vub.ac.be
Mon Jan 10 08:12:28 EST 2005


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.

This is not true.

> So you can use tuples for 'composed key'.

lists can be so used too. Just provide a hash.

-- 
Antoon Pardon



More information about the Python-list mailing list