list vs tuple

Sean 'Shaleh' Perry shaleh at valinux.com
Wed Mar 28 11:16:10 EST 2001


On 28-Mar-2001 deadmeat wrote:
> Whats the practical difference between a list[] and a tuple() ?
> 
> A tuple seems to be a very basic list, so unless it's faster, what's the
> point of it?
> 

As others point out they are immutable.  This can lead to self documenting code.

dir_list = ('/path', '/foo/bar', '/baz/bat/files')

dir_list shouldn't change and this documents it.




More information about the Python-list mailing list