Thanks for the explanations.
Regards,
Raj
On Sat, Aug 23, 2008 at 3:41 PM, Scott David Daniels
<[EMAIL PROTECTED]> wrote:
> Rajanikanth Jammalamadaka wrote:
>
> list(itertools.dropwhile(lambda x: x<5,range(10)))
>>
>> [5, 6, 7, 8, 9]
>>
>> Why doesn't this work?
>
> list(itertool
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
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Because it drops _while_ the condition is True (which it is for
the first 0 entries in the sequence).
Fredrik Lundh wrote:
maybe you meant to use itertools.ifilter?
>>> help(itertools.ifilter)
Help on class ifilter in module itertools:
class ifilter(__builtin__.object)
| ifilter(function or None, sequence) --> ifilter object
|
| Return those items of sequence for which function(item) is
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
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
it works exactly as specified:
>>> help(itertools.dropwhile)
Help on class dropwhile in module i
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 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
It *does* work. `dropwhile()` drops as long as the c