[BangPypers] Tuples vs Lists, perfromance difference

Yuvi Panda yuvipanda at gmail.com
Tue Dec 22 17:36:24 CET 2009


urlpatterns in django use tuples of different types (string, callable), no?

On Tue, Dec 22, 2009 at 9:59 PM, Noufal Ibrahim <noufal at gmail.com> wrote:

> 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.
>
>
> --
> ~noufal
> http://nibrahim.net.in
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
Yuvi Panda T
http://yuvi.in/blog


More information about the BangPypers mailing list