> from sys import stdout > def fun(x): > stdout.write("*") > return x > list(filter(lambda x: True, map(fun, xrange(5)))) Sorry, I meant: from itertools import imap, ifilter from sys import stdout def fun(x): stdout.write("*") return x list(ifilter(lambda x: True, imap(fun, xrange(5))))