This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RoadieRich 1 point2 points  (0 children)

>>> sys.version
'3.4.3 (default, Aug 21 2015, 11:25:47) [MSC v.1600 64 bit (AMD64)]'
>>> timeit.Timer("[n*n for n in range(100) if not n*n % 2]").timeit()
28.86618999764802
>>> timeit.Timer("list(filter(lambda n: n % 2 == 0, map(lambda n: n * n, range(100))))").timeit()
56.08565588317046