Help understanding the decisions *behind* python?

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Jul 23 13:21:59 EDT 2009


Phillip B Oldham wrote:
> My colleagues and I have been working with python for around 6 months
> now, and while we love a lot of what python has done for us and what
> it enables us to do some of the decisions behind such certain
> data-types and their related methods baffle us slightly (when compared
> to the decisions made in other, similarly powerful languages).
> 
> Specifically the "differences" between lists and tuples have us
> confused and have caused many "discussions" in the office. We
> understand that lists are mutable and tuples are not, but we're a
> little lost as to why the two were kept separate from the start. They
> both perform a very similar job as far as we can tell.
> 

[rest of original snipped as already discussed]

Sorry if this has been discussed and I've missed it, but how about 
memory allocation.  An immutable tuple has a fixed memory allocation 
whereas that for the mutable list must be liable to change.  You might 
like to look at the recent thread on this ng 'List insertion cost' and 
follow the links to Raymond Hettinger's power point presentation.

Kindest regards.

Mark Lawrence.




More information about the Python-list mailing list