maximum length of a list & tuple

Josiah Carlson jcarlson at uci.edu
Mon Apr 12 14:43:58 EDT 2004


>> You can't just store the integer.  How would you differentiate between 
>> an integer in a list and a pointer?  Answer: you must use 
>> PyIntObjects.  Use the source.
> 
> 
> Python does not recognize anything called "pointers" at the language
> level, only internally.
> 
> What I was saying is that the only PyIntObject created was one with
> the ob_ival of 1.  Then a list containing one pointer to it was
> created.  Then it was replicated "c" times.  Only one integer.

Yeah, I was thinking of the case in generating a sequence of integers 
via range.  In that case, range(N) produces 12-byte intobjects and 4 
byte pointers.  In the case of c*[1), indeed you are right, one object 
gets created, and some c pointers to that object are generated for the list.

Seems I got off topic and we are both right.

  - Josiah



More information about the Python-list mailing list