Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyrex versus python
#11
Translated....

def primes(kmax):
    result = []
    p = []
    if kmax > 1000:
        kmax = 1000
    k = 0
    n = 2
    while k < kmax:
        i = 0
        while i < k and n % p[i] != 0:
            i = i + 1
        if i == k:
            p.append(n)
            k = k + 1
            result.append(n)
        n = n + 1
    return result

print(primes(1000))
Pyrex was a tool that combine C and Python syntax in a single file and could be compiled into an extension module. It became Cython and is used extensively in the scientific environment.

Can I recommend that you actually provide the actual error message and not just state that something doesn't work? And letting use know what you want to accomplish it helpful, too.
Reply


Messages In This Thread
Pyrex versus python - by sylas - Jul-24-2018, 10:05 AM
RE: Pyrex versus python - by nilamo - Jul-24-2018, 05:30 PM
RE: Pyrex versus python - by sylas - Jul-25-2018, 05:54 AM
RE: Pyrex versus python - by Larz60+ - Jul-25-2018, 10:17 AM
RE: Pyrex versus python - by nilamo - Jul-25-2018, 05:39 PM
RE: Pyrex versus python - by sylas - Jul-25-2018, 05:55 PM
RE: Pyrex versus python - by nilamo - Jul-25-2018, 06:08 PM
RE: Pyrex versus python - by sylas - Jul-26-2018, 08:59 AM
RE: Pyrex versus python - by Larz60+ - Jul-26-2018, 09:27 AM
RE: Pyrex versus python - by sylas - Jul-26-2018, 09:55 AM
RE: Pyrex versus python - by casevh - Jul-27-2018, 03:31 AM
RE: Pyrex versus python - by Larz60+ - Jul-27-2018, 03:34 AM
RE: Pyrex versus python - by sylas - Jul-27-2018, 05:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Determine if keyboard interrupt versus SIGINT trapped? Jibunnokage 5 1,870 Sep-30-2022, 06:54 AM
Last Post: Gribouillis
  Wsgiref versus Requisitions JohnnyCoffee 1 1,672 Jun-14-2020, 05:15 PM
Last Post: Larz60+
  Config file entry as list versus string? taziuk 2 1,887 Apr-25-2020, 12:01 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020