
On Sun, Nov 9, 2008 at 9:56 PM, Carl Johnson <carl@carlsensei.com> wrote:
words = ["blah one", "Blah two", " bLAh three"] sorted(words, key=@(word)): ... word = word.lower() ... word = word.replace("one", "1") ... word = word.replace("two", "2") ... word = word.replace("three", "3") ... word = word.replace(" ", "") ... return word ... [u'blah one', u'Blah two', u' bLAh three']
This bothers me. You seem to have some kind of syntax error here, because you have two parens before the colon. I don't know if you meant to do this, but it seems very, very strange the way you have it, and the obvious alternative seems strange as well:
sorted(words, key=@(word): ... word = word.lower() ... ... ... return word) ... [stuff]
Since I can't think of a reasonable way to fix this, I'm going to have to -1 it. Also, I think in the light that lambda functions are just hard to work with in general (as seductive as they are when you're typing), I'd rather encourage people to formally specify any functions they are going to use, if only to give them a chance to be tested (Hey look, I'm promoting TDD! How out of character!). -- Cheers, Leif