In article <50a8acdc$0$29978$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote:

> Use a list when you want a list of items that should all be treated the 
> same way [...] or when you need a collection of items where the order they 
> are in is 
> important:
>
> Use a tuple when you want a collection of items that mean different 
> things, a bit like a C struct or Pascal record:

That is certainly the right answer according to the One True Church Of 
Pythonic Orthodoxy And Theoretical Correctness.  But, let me give an 
alternative answer which works for The Unwashed Masses Who Live In The 
Trenches And Write Python Code For A Living:

Use a list when you need an ordered collection which is mutable (i.e. 
can be altered after being created).  Use a tuple when you need an 
immutable list (such as for a dictionary key).
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to