[BangPypers] Tuples vs Lists, perfromance difference

Sidharth Kuruvila sidharth.kuruvila at gmail.com
Tue Dec 22 16:13:07 CET 2009


Hi,
  I don't think you should see and difference in performance. Lists
might take a bit more space since they usually preallocate memory for
future inserts.

  I'd go for lists where ever i need to use an array or a list, and
tuples for storing records.

Regards,
Sidharth



On Tue, Dec 22, 2009 at 7:10 PM, Vishal <vsapre80 at gmail.com> wrote:
> Hi,
>
> I was presuming that since tuples are immutable, like strings, and string
> immutability increases performance (
> http://effbot.org/pyfaq/why-are-python-strings-immutable.htm)
> so also, using tuple would improve performance over Lists.
>
> is this presumption correct?
>
> if it is, then as a practice, If I know the contents of my sequence at the
> time of initialization and the fact that the sequence is not going to change
> at runtime, would it be always good to use tuples instead of lists.
>
> Any views on this one?
>
> Thanks and best regards,
> Vishal Sapre
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
I am but a man.


More information about the BangPypers mailing list