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

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

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 pre 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 inheriting

NetworkX.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
.



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5649099.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存