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
#12
Quote: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.
I didn't know that until now, knew about Cython, but not that it evolved fron Pyrex
Reply
#13
Thanks to casevh for the translation. It works fine.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Determine if keyboard interrupt versus SIGINT trapped? Jibunnokage 5 1,807 Sep-30-2022, 06:54 AM
Last Post: Gribouillis
  Wsgiref versus Requisitions JohnnyCoffee 1 1,639 Jun-14-2020, 05:15 PM
Last Post: Larz60+
  Config file entry as list versus string? taziuk 2 1,833 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