diff --git a/source-code/cython/Primes/primes_pure_malloc.py b/source-code/cython/Primes/primes_pure_malloc.py index 2594915..ee3706f 100644 --- a/source-code/cython/Primes/primes_pure_malloc.py +++ b/source-code/cython/Primes/primes_pure_malloc.py @@ -17,6 +17,6 @@ def primes(nr_primes: cython.int): primes[nr_found] = n nr_found += 1 n += 1 - result = [prime for prime in primes[:nr_found]] + result = list(primes[:nr_found]) free(primes) return result diff --git a/source-code/cython/Primes/primes_pure_python.py b/source-code/cython/Primes/primes_pure_python.py index aeceabc..7aff934 100644 --- a/source-code/cython/Primes/primes_pure_python.py +++ b/source-code/cython/Primes/primes_pure_python.py @@ -3,8 +3,7 @@ def primes(nr_primes: cython.int): primes: cython.int[1000] - if nr_primes > 1000: - nr_primes = 1000 + nr_primes = min(nr_primes, 1000) if not cython.compiled: primes = [0] * 1000 print('fall back on Python', file=sys.stderr) @@ -18,4 +17,4 @@ def primes(nr_primes: cython.int): primes[nr_found] = n nr_found += 1 n += 1 - return [prime for prime in primes[:nr_found]] + return list(primes[:nr_found]) diff --git a/source-code/cython/Primes/primes_vanilla.py b/source-code/cython/Primes/primes_vanilla.py index 7cc3d1b..7bad6b8 100644 --- a/source-code/cython/Primes/primes_vanilla.py +++ b/source-code/cython/Primes/primes_vanilla.py @@ -1,7 +1,6 @@ def primes(nr_primes): primes = [0]*1000 - if nr_primes > 1000: - nr_primes = 1000 + nr_primes = min(nr_primes, 1000) n = 2 nr_found = 0 while nr_found < nr_primes: