Re: [Tutor] tuples versus lists

2006-09-15 Thread Dave Kuhlman
On Thu, Sep 14, 2006 at 11:14:20PM -0700, Bob Gailer wrote: > John Fouhy wrote: > > Generally, you should use a tuple when you have different things that > > you want to clump together to make one data structure. Whereas you > > should use a list when you have multiple things that are the same, >

Re: [Tutor] tuples versus lists

2006-09-14 Thread Bob Gailer
John Fouhy wrote: > Generally, you should use a tuple when you have different things that > you want to clump together to make one data structure. Whereas you > should use a list when you have multiple things that are the same, > that you want to iterate over. > Different perspective: tuples ar

Re: [Tutor] tuples versus lists

2006-09-14 Thread John Fouhy
Generally, you should use a tuple when you have different things that you want to clump together to make one data structure. Whereas you should use a list when you have multiple things that are the same, that you want to iterate over. -- John. ___ Tuto

Re: [Tutor] tuples versus lists

2006-09-14 Thread Michael P. Reilly
Tuples, like other immutable data types, are hashable (assuming the contents are immutable as well), and so they can be used as keys to dictionaries.  Lists cannot be used this way. >>> {['a']: 'a'}Traceback (most recent call last):  File "", line 1, in ?TypeError: list objects are unhashable>>> {(

Re: [Tutor] tuples versus lists

2006-09-14 Thread Tim Johnson
* Kermit Rose <[EMAIL PROTECTED]> [060914 18:29]: > Hello Brian. > > Today I read through chapter five of the python tutorial and discovered > that tuples are not the same thing as lists. > > This surprised me. > > I do not see any difference in the capability of lists and tuples. Hi Kermi

[Tutor] tuples versus lists

2006-09-14 Thread Kermit Rose
Hello Brian. Today I read through chapter five of the python tutorial and discovered that tuples are not the same thing as lists. This surprised me. I do not see any difference in the capability of lists and tuples. Why would you use one in preference to the other? Kermit < [EMAIL PROTE