嗯,终于找到了“回答自己的问题”按钮。
我可能没有耐心,但是由于没有人答复(我的意思是谁在使用Cython并在星期四下午回答问题),所以我认为我将关闭此程序。
1) Cython doesn’t like deepcopy on Classes which have function/method referenced variables. Those variable copies will fail. From what I can tell, there’s no working around it, you just have to come up with an new design that doesn’t require them. I ended up doing so with the same code above, and in my project.
2) Cython doesn’t handle the property decorators at all. You can’t @property
and @<property name>.setter
. Properties need to be set the old fashion way. e.g. <property name> = property(get_property, set_property)
.
3) An inherited non-Cython class’s methods “might” not be accessible. I kNow this vague. I can’t completely explain it. All I’ll say is I was inheritingNetworkX.DiGraph
, and number_of_nodes()
was no accessible after Cython, when it was straight Python. I had to create a reference to the method and use it. e.g. number_of_verts = NetworkX.DiGraph.number_of_nodes
.