def generate_primes(upper=0):
    """
    Generate a list of primes from 2 to a set limit
    It reuses the sieve of Eratosthenes

    Returns a list of integer.

    """
    primes = [2]
    for n in range(3, upper + 1):
        k = 0
        while primes[k] <= pow(n, 0.5) and n % primes[k] != 0:
            k += 1
        if pow(n, 0.5) < primes[k]:
            primes.append(n)
    return primes
