Doctest failing
Tigerstyle
laddosingh at gmail.com
Sun Sep 11 12:40:26 EDT 2011
More information about the Python-list mailing list
Sun Sep 11 12:40:26 EDT 2011
- Previous message (by thread): Doctest failing
- Next message (by thread): Doctest failing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10 Sep, 17:56, Chris Angelico <ros... at gmail.com> wrote: > On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware > > <alister.w... at ntlworld.com> 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. > > ChrisA Lambda is too complicated for me to understand yet. Will get there after a little while. Where would you put this piece of code?
- Previous message (by thread): Doctest failing
- Next message (by thread): Doctest failing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list