[Pyrex] newbie question: error using pyrex

Christian Meesters meesters at uni-mainz.de
Tue Sep 18 14:45:24 CEST 2007


Hi,

I'm a first time user of pyrex and tried to translate that piece of code
using pyrex:

cdef extern from "math.h"

def pofr(vectors):
    distances = list()
    cdef int n
    n = len(vectors)
    for i from 0 <= i < n:
        for j from i+1 <= j < n:
            a = vector[i]
            b = vector[j]
            dist = sqrt((a[0]-b[0]) * (a[0]-b[0]) +
                        (a[1]-b[1]) * (a[1]-b[1]) +
                        (a[2]-b[2]) * (a[2]-b[2]))
            distances.append(dist)
    return distances

running 'pyrexc pofr_module.pyx' results in this error message:
/home/cm/bin/mc_rigid_dir/src/pofr_module.pyx:1:25: Expected ':'

I'm using Ubuntu's 0.9.4.1-2ubunut1 package of pyrex, for it matters.

Can anybody give me a hint on what my mistake is?

TIA
Christian



More information about the Pyrex mailing list