[Tutor] help

Kalle Svensson kalle@gnupung.net
Sun, 16 Sep 2001 03:16:52 +0200


[Cameron Stoner]
> What is wrong with this code?  When I ran this in the IDLE it brought up an
> unhashable type error.

To be used as keys in dictionaries, objects must be hashable.  This is a sort
of difficult concept to explain and it's past 3 AM here in Sweden, so I'll
just leave that to Danny Yoo... <wink>
Anyway, python lists are *not* hashable.

> import string
> y = raw_input('prompt:')
> while y is not '':
>    sep_letter = (string.split(y[0][-1]))

Try a
print sep_letter
here, and you'll see what's wrong.

>    while sep_letter is not '':
[snip]

Peace,
  Kalle
-- 
[ Thought control, brought to you by the WIPO! ]
[ http://anti-dmca.org/ http://eurorights.org/ ]