P
Peter Hansen
Alex said:Peter Hansen wrote:
...
One counterexample from the dark ages:
map(twoargsfunc, lotsoffirstargs, (onesecondarg,)*len(lotsoffirstargs))
the memory consumption of all the constructed tuple's elements is
fixed -- sizeof(onesecondarg) if Python has sizeof (don't you wish...;-),
as all slots in the tuple point to that one object.
So, here, the overhead of the structure itself might be important,
since the elements in that structure aren't; so a tuple MAY be a good
thing.
Certainly there are cases, such as your example and doubtless others.
"Initializing constant lists at the beginning of the program" likely
isn't one of them, except in exceptional cases.
-Peter