Help understanding the decisions *behind* python?

Aahz aahz at pythoncraft.com
Fri Jul 24 02:25:16 CEST 2009


In article <mailman.3616.1248369685.8015.python-list at python.org>,
Mark Lawrence  <breamoreboy at yahoo.co.uk> wrote:
>
>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.

Not only that, but lists use more memory, period, for any given number of
elements because the overallocation permits amortized constant time for
appends.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"At Resolver we've found it useful to short-circuit any doubt and just        
refer to comments in code as 'lies'. :-)"
--Michael Foord paraphrases Christian Muirhead on python-dev, 2009-03-22



More information about the Python-list mailing list