Doctest failing

Ethan Furman ethan at
Sun Sep 11 14:43:38 EDT 2011

Chris Angelico wrote:
> On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware
> <alister.ware at> wrote:
>> Ignoring the docttests my process would be to process each word & then
>> manually capitalize he 1st word, .I would als0 use a comprehension as
>> makes for cleaner code:-
>> def capitalize(word):
>>    if word in small_words:
>>        return word
>>    else:
>>        return word.title()
> And I'd do this with a lambda, but that's just me. Of course, if your
> logic is more complicated, it makes more sense to keep it in a named
> function, but a single conditional call can fit nicely into a lambda.

Lambdas are great when needed, but if don't *need* it, and you have more 
than a few, debugging can be a nightmare... "Okay, so this is function 
<lambda>... and that is function <lambda>... and over here we also have 
function <lambda>... ARGH!"


More information about the Python-list mailing list