Howegrown wordcount

Thomas Philips tkpmep at
Sat Jun 12 02:42:40 CEST 2004

An embarrassing mistake on my part: I should have typed
     #Treat iterable inputs differently
     if "__iter__" in dir(input):
         wordList =(" ".join([str(item) for item in input])).split()
         wordList = str(input).split()

I wish I knew how to treat all possible inputs in a uniform fashion,
but I'm nowhere near there as yet, hence the question. That said, it
addressess the situations that arise in practice fairly well, though I
am sure it can be sped up substantially.

Thomas Philips

More information about the Python-list mailing list