list vs tuple

deadmeat root at [127.0.0.1]
Thu Mar 29 02:11:43 EST 2001


> >>> dir_list = ('/path', '/foo/bar', '/baz/bat/files')
> >>> print dir_list
> ('/path', '/foo/bar', '/baz/bat/files')
> >>> dir_list = ('/usr/bin/env', '/usr/bin', '')
> >>> print dir_list
> ('/usr/bin/env', '/usr/bin', '')
> I don't see how dir_list is a constant?

The values within it are read-only, not the name 'dir_list'

dir_list[0] = 'this will fail'

convert to a list and run it again it'll work fine.







More information about the Python-list mailing list