writing code over several lines

Peter Hansen peter at engcorp.com
Tue Oct 21 12:03:37 EDT 2003


Paul Rubin wrote:
> 
> Peter Hansen <peter at engcorp.com> writes:
> > Tuples are also not significantly faster than lists, as I recall
> > from past discussions of this.  At least, not to the extent that
> > it should ever be a consideration when initializing "constant" lists.
> 
> 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).

-Peter




More information about the Python-list mailing list