>>> {['a']: 'a'}
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: list objects are unhashable
>>> {('a',): 'a'}
{('a',): 'a'}
>>>
-Arcege
On 9/14/06, Tim Johnson <[EMAIL PROTECTED]> wrote:
* 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 Kermit:
Tuples are "read-only" - you can't modify a tuple,
you can produce a tuple from a list by using the
tuple() function.
you can produce a list from a tuple by using the
list() function - but the original tuple is unchanged.
You can return multiple values from a function
using tuples.
>
> Why would you use one in preference to the other?
I use tuples as above and where I don't want data
changed...
tim
--
Tim Johnson <[EMAIL PROTECTED] >
http://www.alaska-internet-solutions.com
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
There's so many different worlds,
So many different suns.
And we have just one world,
But we live in different ones.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor