[Python-Dev] Typo in itertools.dropwhile()
matthieu.brucher at gmail.com
Fri Jul 13 07:21:48 CEST 2007
2007/7/13, Raymond Hettinger <python at rcn.com>:
> [Matthieu on itertools.dropwhile() docs]
> > Make an iterator that drops elements from the iterable as long as the
> predicate is true; afterwards, returns every element. Note,
> > the iterator does not produce any output until the predicate is true, so
> it may have a lengthy start-up time.
> > It says something and then the opposite, so which one is true ?
> It is correct as written. Given a sequence where predicate is true 1000
> times and then alternately false and true, it returns the
> part that is alternately false and true. So, it did DROP (omit, not
> return, skip-over, etc) the first 1000 true items and it did
> return EVERY element from the first false to the end. It did not produce
> any output for the first 1000 inputs so it took a while to
> get to the first output (the first false). Hope that clears it up for
Thanks for the answer.
I agree with you, but this explains the first sentence. The second says that
nothing is output until the predicate is true. It should say" while the
predicate is true" or "until the predicate is false". But I could be
misunderstand 'until' as well (English is not my mother tongue, but
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev