Closed Hazurl closed 6 years ago
just to note, this may potentially be slower due to having to evaluate all the expressions in the list, but its a good use of python features and its looks great!
I believe if you remove the []
it will be evaluated lazily. (and therefore the same speed as previously).
Did a couple of tests, seems to be correct
>>> import timeit
>>> timeit.timeit('any([x == 52 for x in l])',setup='l = [x for x in range(1000)]', number=10000)
0.4704603556645566
>>> timeit.timeit('any(x == 52 for x in l)',setup='l = [x for x in range(1000)]', number=10000)
0.04013646315647179
Changed in #15
ah yes, very nice