cython失败或我做错了吗?

我可以在交互式python中import teapot

#teapot.py
class _A():
    def __init__(self):
        self.a = 1

def _gen(c,AB):
    class ABC(AB):
        def __init__(self):
            super().__init__()
            self.c = c
    return ABC

_AC = _gen(3,_A)


print(_AC)
print(_AC())

但是在我cythonize -X language_level=3 -i teapot.py之后,启动python交互式会话,然后import teapot,该交互式会话直接退出。怎么了?

 Name                    Version                   Build  Channel

cython                    0.29.10          py37h6538335_0    conda-forge

python                    3.7.4                h5263a28_0
wanlili3646 回答:cython失败或我做错了吗?

将行更改为

      super(ABC,self).__init__()

对我来说很明显,Cython尚未赶上。它是Python的相对新功能。我花了好几天!

本文链接:https://www.f2er.com/3066225.html

大家都在问