「通常の方法」は間違いなく最良の方法ですが、必要になる理由が何であれ、消費itertoolsレシピを提供します。
import collections
from itertools import islice
def consume(iterator, n):
"Advance the iterator n-steps ahead. If n is none, consume entirely."
# Use functions that consume iterators at C speed.
if n is None:
# feed the entire iterator into a zero-length deque
collections.deque(iterator, maxlen=0)
else:
# advance to the empty slice starting at position n
next(islice(iterator, n, n), None)
これは次のように使用できます。
consume(imap(func, my_list), None) # On python 3 use map
この関数は、C側で実行される関数を使用することにより、Python forループのオーバーヘッドを回避するため、最も高速に実行されます。