#!/bin/env python3

def get_primes():
    "Simple lazy Sieve of Eratosthenes"
    candidate = 2
    found = []
    while True:
        if all(candidate % prime != 0 for prime in found):
            yield candidate
            found.append(candidate)
        candidate += 1

# create a generator        
primes = get_primes()
# use generator
print(next(primes), next(primes), next(primes))
# (2, 3, 5)
# use generator inside a for loop
for _, prime in zip(range(10), primes):
    print(prime, end=" ")        
