Scott David Daniels wrote:
> John Coleman wrote:
> > Blackbird wrote:
> >> 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)
>
> And, for 2.4 or later:
>
>      def letter_hash(word):
>          return "".join(sorted(word))
>
> sorted takes an iterable, and strings are iterables.
>
> --Scott David Daniels
> [EMAIL PROTECTED]

Impressive. It is this ability to create single expressions (like
"".join(sorted(word))) which take the place of entire algorithms in
other languages which I find one of the most striking features of
Python.

-John Coleman

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to