Good use for itertools.dropwhile and itertools.takewhile

Neil Cerutti neilc at
Wed Dec 5 14:29:13 CET 2012

On 2012-12-05, Nick Mellor <thebalancepro at> wrote:
> Hi Terry,
> For my money, and especially in your versions, despite several
> expert solutions using other features, itertools has it. It
> seems to me to need less nutting out than the other approaches.
> It's short, robust, has a minimum of symbols, uses simple
> expressions and is not overly clever. If we could just get used
> to using takewhile.

The main reason most of the solutions posted failed is lack of
complete specification to work with while sumultaneously trying
to make as tiny and simplistic a solution as possible.

I'm struggling with the empty description bug right now. ;)

Neil Cerutti

More information about the Python-list mailing list