On May 21, 4:48 pm, Szabolcs <[EMAIL PROTECTED]> wrote:
> In what circumstances is it advantageous to use tuples instead of lists?
> Is there a difference in performance?
>

As you should not, tuples are immutable while lists are mutable. You
can think of all the scenarios where immutable datatype are required.

1) Return values from a function.  When you return multiple values
from a function. You store them as a tuple and access them
individually rather then in the list, which bear the danger of being
modified.
Look up the standard library itself and you will find many instances.

(cin, cout, cerr) = os.popen3('man man')

If you had the above as list, then you might end up spoiling things
knowingly/unknowingly.

2) Programming requirements arise when you have to deal with
persistent data.


HTH.
Senthil

http://uthcode.sarovar.org

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to