Lists and Tuples

Michael T. Babcock mbabcock at fibrespeed.net
Fri Dec 5 13:43:46 EST 2003


I'm not sure if its a good answer or not, but I use tuples when the 
number of items can't / won't change and arrays/lists when they may or 
will change.

def get_values():
    #... do stuff ...
    return (x,y,z)

(x,y,z) = get_values()

PS, you can turn a tuple into a list quickly with list compressions;

list = [ x for x in tuple ]

-- 
Michael T. Babcock
C.T.O., FibreSpeed Ltd.
http://www.fibrespeed.net/~mbabcock







More information about the Python-list mailing list