On Sat, 23 Aug 2008 14:54:09 -0700, Rajanikanth Jammalamadaka wrote:

>>>> list(itertools.dropwhile(lambda x: x<5,range(10)))
> [5, 6, 7, 8, 9]
> 
> Why doesn't this work?
>>>> list(itertools.dropwhile(lambda x: 2<x<5,range(10)))
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

It *does* work.  `dropwhile()` drops as long as the callable returns a 
true value and then it stops dropping.  First value is 0 and
``2 < 0 < 5`` is `False` so nothing is dropped.

What have you expected?

Ciao,
        Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to