John Coleman <[EMAIL PROTECTED]> skrev: > John Salerno wrote: >> John Coleman wrote: >>> John Coleman wrote: >>>> Greetings, >>>> I am currently trying to learn Python through the excellent >>>> "Learning Python" book. >> >> me too! >> >>> It isn't just #hash, but also things like #dict, #int, #len at the >>> start of a comment line which defeats IDLE's colorization algorithm. >>> Interestingly, things like #while or #for behave as expected so it >>> seems to be built-ins rather than keywords which are the problem. To >>> answer my own question - this is pretty clearly a (harmless) bug. >> >> also notice that putting a space after # stops the problem > > How do you like Python so far? I like dictionary objects the best so > far. I'm coming to Python from VBScript, so I already knew the value > of such things, but in Python they are better supported. > > Here is the program I was talking about, which *really* shows the > power of dictionaries: > > **************************************************************************** ************* > > #Python program to discover word with most 1-word anagrams >[...]
Nice! I think this simpler version of letter_hash should work too: def letter_hash(word): w = [c for c in word] w.sort() return "".join(w) -- http://mail.python.org/mailman/listinfo/python-list