您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Cython和deepcopy()在引用的方法/功能方面陷入困境。还有其他想法吗?

Cython和deepcopy()在引用的方法/功能方面陷入困境。还有其他想法吗?

嗯,终于找到了“回答自己的问题”按钮。

我可能没有耐心,但是由于没有人答复(我的意思是谁在使用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.

其他 2022/1/1 18:46:33 有475人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶