how to mutate a tuple?

Carlo v. Dango oest at soetu.eu
Tue Oct 14 09:22:47 EDT 2003


Hello there. I have a function which as an argument takes a tuple and 
either returns that tuple or a mutated version of it. The problem is that 
tuples are imutable, hence I have to create a new tuple and copy the 
content of the old tuple to a new one.

But how do I do this if I only at runtime know the size of the tuple? I 
wish I could pass around lists instead.. that would be so much easier, but 
I'm passing "*args" and "**kwargs" around so I'm not really the one 
deciding the use of tuples or lists ;)

Am I the first one with a problem like this? I'm not able to find anything 
using google on this topic. Hope someone can help me ;)

-Carlo v. Dango


-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/




More information about the Python-list mailing list