Tuple question

Aahz aahz at pythoncraft.com
Thu Sep 2 16:09:50 EDT 2004


In article <P5GdnUwq-8QI6KrcRVn-qg at powergate.ca>,
Peter Hansen  <peter at engcorp.com> wrote:
>
>Why do you think tuples use significantly less memory than lists?
>As far as I know, they don't.  (They do use less, but if you are
>really talking about huge amounts of data such that you would
>be trying to optimize in this way, then the amount that they use
>is not *significantly* less.)

Actually, if you have large numbers of short sequences, the memory
savings from tuples can indeed be significant.  I don't remember off-hand
what the number is, but I think it's something on the order of 20%.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"To me vi is Zen.  To use vi is to practice zen.  Every command is a
koan.  Profound to the user, unintelligible to the uninitiated.  You
discover truth everytime you use it."  --reddy at lion.austin.ibm.com



More information about the Python-list mailing list