+ 1

takewhile and filter

so is there any difference between takewhile and filter functionay?

5th Aug 2016, 1:12 PM
javad ghaedi
javad ghaedi - avatar
4 Réponses
+ 2
Ok after some research i have found that takewhile stops when the condition is not met while filter evaluate the whole list.
5th Aug 2016, 1:29 PM
Slimani Mohammed
Slimani Mohammed - avatar
+ 1
i guess that when you need to use takewihle you have to import it from itertools but filter is a pridefined function. I hope that help you make a deference ^^
5th Aug 2016, 1:16 PM
Slimani Mohammed
Slimani Mohammed - avatar
+ 1
hmmm it make sense, thanks very much gonna apply it in console
5th Aug 2016, 1:33 PM
javad ghaedi
javad ghaedi - avatar
0
yeah i know this one thanks anyway. i was excepting a more important difference cuz if this was all the difference so why should somebody bother to rewrite it at the first place
5th Aug 2016, 1:19 PM
javad ghaedi
javad ghaedi - avatar