Why is any (True for … if cond) much faster than any (cond for …)?

The first method sends everything to any() whilst the second only sends to any() when there’s an odd number, so any() has fewer elements to go through.

Leave a Comment