Reputation: 53
I went through a few cython tutorials and felt comfortable beginning to mess around with my own conversion. The first thing I did was copy paste my python code and compile it to make sure it was working. However, the cython compiled code gives a different (and wrong) output, even though I didn't change a thing.
My understanding was that cython can compile python? I would link the code but it's fairly large in comparison to most code pasted. My biggest question is what types of python code isn't compiled correctly by cython when directly copied?
Upvotes: 1
Views: 148
Reputation: 53
I found the solution. In python my line of code read:
TM[adjMut[f]][i] = 1 / len(fitter)
In cython i had to declare the 1 as 1.0:
TM[adjMut[f]][i] = 1.0 / len(fitter)
In many hundreds of lines of codes, that's the only difference. I'm not sure if it's a bug or intended, but there it is!
Upvotes: 1