Looking for info on Python's memory allocation

Steven D'Aprano steve at REMOVEMEcyber.com.au
Mon Oct 10 21:51:21 EDT 2005


Can somebody help me please? I've spent a fruitless 
hour googling with no luck.

I'm discussing memory allocation techniques with 
somebody, and I'm trying to find a quote from -- I 
think -- Tim Peters where he discusses the way Python 
allocates memory when you append to lists. In basic 
terms, he says that every time you try to append to a 
list that is already full, Python doubles the size of 
the list. This wastes no more than 50% of the memory 
needed for that list, but has various advantages -- and 
I'm damned if I can remember exactly what those 
advantages were.

Can anyone point me in the right direction?

Thanks,


-- 
Steven.




More information about the Python-list mailing list