[BangPypers] Tuples vs Lists, perfromance difference

Noufal Ibrahim noufal at gmail.com
Tue Dec 22 17:29:54 CET 2009

On Tue, Dec 22, 2009 at 9:52 PM, Roshan Mathews <rmathews at gmail.com> wrote:

> [..]
> http://jtauber.com/blog/2006/04/15/python_tuples_are_not_just_constant_lists/
>    Tuples are not constant lists -- this is a common
>    misconception. Lists are intended to be homogeneous
>    sequences, while tuples are hetereogeneous data
>    structures.[..]

 This is an 'intention' rather than an enforced rule isn't it? It does seem
natural though. I don't think i've ever seen a tuple with elements of
different types.

My thumb rule is if you need an immutable structure (often for a dictionary
key), use a tuple. Otherwise, use a list.


More information about the BangPypers mailing list