[BangPypers] Tuples vs Lists, perfromance difference
rmathews at gmail.com
Tue Dec 22 19:10:09 CET 2009
On Tue, Dec 22, 2009 at 9:59 PM, Noufal Ibrahim <noufal at gmail.com> wrote:
> 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.
I use namedtuple for those, (or just plain classes before I knew of that.)
> My thumb rule is if you need an immutable structure (often for a dictionary
> key), use a tuple. Otherwise, use a list.
Yeah, that pretty much sums up what I do too.
I googled the links just before I posted, because while I thought that
tuples were faster (I think I used them once for that reason), I
couldn't remember why.
More information about the BangPypers