writing code over several lines

Paul Rubin http
Tue Oct 21 12:46:51 EDT 2003


Peter Hansen <peter at engcorp.com> writes:
> > Tuples probably aren't faster, but they do use less memory.
> 
> Again, as I recall the past discussions, not significantly so.  
> 
> They still have only four bytes (a pointer) per element, and surely for
> any tuple or list where one could possibly be concerned about memory
> consumption the number of elements far outweighs the overhead associated
> with the structure itself (which is probably on the order of a few bytes
> anyway).

Lists allocate memory for extra elements, so list.append doesn't have
to copy the whole list around every time you call it. 




More information about the Python-list mailing list