bug report for itertools.takewhile
24 Jan
2018
24 Jan
'18
8:19 a.m.
hi, python officer I am not sure whether it is a correct behavior for takewhile function from itertools import takewhile print(list(takewhile(lambda x:x%2==0, [2,1]))) print(list(takewhile(lambda x:x%2==0, [1,2]))) this codes results [2] [] it seems that all the elements after 1 (in the second argument ) will be ignored(or discarded) by takewhile function print(list(takewhile(lambda x:x%2==0, [2,1,4,6,8]))) [2] print(list(takewhile(lambda x:x%2==0, [1,2,4,6,8]))) [] it appeared on python3.5.2(win64) and python 3.6.4(CentOS7.1). I do not test on other version of python your sincerely Jacky
2481
Age (days ago)
2481
Last active (days ago)
0 comments
1 participants
participants (1)
-
reloaded