what happens inside?

Tim Rowe digitig at gmail.com
Wed Jun 22 12:08:40 EDT 2011


On 22 June 2011 16:53, Andrew Berg <bahamutzero8825 at gmail.com> wrote:
> On 2011.06.22 10:45 AM, Chetan Harjani wrote:
>> why tuples are immutable whereas list are mutable?
> Tuples are more efficient and more appropriate for a list of items that
> doesn't need to change.

And also it sometimes useful to be sure that something can't change.
In particular, efficient dictionary implementations need the keys to
be immutable, because it you change a key it /really/ fouls up the
look-up.

-- 
Tim Rowe



More information about the Python-list mailing list