adding elements to python tuples

Uwe Mayer merkosh at hadiko.de
Mon Jan 19 06:22:36 EST 2004


Hi,

is it possible to append new elements to a tuple? I know tuples are
immutable and that this would mean to create a new tuple with one more
element, but how do you do it?

i.e. i have  (1,2,3) and want to append 4:
(1,2,3,4) instead of ((1,2,3),4)

I wanted to use it as a return value of a function and an assignment, but:

(a,b,c),d = myfunc()

doesn't look nice to me. I intended to have 

a,b,c,d = myfunc()

Thanks for any suggestions.
Ciao
Uwe
-- 
        



More information about the Python-list mailing list