maximum length of a list & tuple

Peter Hansen peter at engcorp.com
Mon Apr 12 07:22:26 EDT 2004


Peter Hansen wrote:

> Josiah Carlson wrote:
> 
>> Checking the memory usage of Python before and after the creation of 1 
>> million integer list, I get a /very/ consistant ~16 bytes per.  That 
>> would be 12 bytes for the object, and 4 bytes for each pointer in the 
>> list.  
> 
> Please post the expression you are using, for comparison.

By the way, in case it wasn't clear, we have a disagreement (and perhaps
a misunderstanding) only about the meaning of the original code posted.
You believe it is allocating many integers.  I believe it allocates
only a single one.  Perhaps one of us is wrong.  I hadn't read the code
in great detail, and still haven't, and perhaps that's my mistake.
Depending on your reply, I'll actually go back and look at it closely
and perhaps execute it myself and see the result (in terms of the list
produced, not in terms of the memory consumption).  Maybe you will
do the same and we'll identify which of us is mistaken...

-Peter



More information about the Python-list mailing list