functional python: a simple infinite list example

The object oriented, “duck typed” programming language python has also some functional features on par with serious functional languages. One example for these advanced functional elements are the infinite lists (as generators and iterators): # sieve of Erastothenes from itertools import count from itertools import ifilter def sieve(possible_primes): yield next_prime for i in sieve(ifilter(lambda … Continue Reading