+ 1
It looks like takewhile(itertools) is same as filter. Is there any difference?
I have tested and it looks like they are inter changeable.
1 Resposta
+ 1
I believe takewhile iterates only till it finds the first mismatch/false predicate and then stops. however filter completes full iteration over the predicate range irrespective of intermediate mismatch/false.