list vs tuple
BrianQ at ActiveState.com
Wed Mar 28 19:25:55 CEST 2001
I'm not sure that this is a reasonable piece of self documentation since
dir_list can change. It is the tuple ('/path', '/foo/bar', '/baz/bat/files')
that cannot change. Would you say that x = 5 documents that x cannot change?
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Sean 'Shaleh' Perry
Sent: Wednesday, March 28, 2001 8:16 AM
Cc: python-list at python.org
Subject: RE: list vs tuple
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
dir_list = ('/path', '/foo/bar', '/baz/bat/files')
dir_list shouldn't change and this documents it.
More information about the Python-list