Cython Pure Python Mode

I have a simple test.py file where I want to add types using Cython. To maintain compatibility with the python interpreter, I use pure python mode. I added:

 import cython 

And then try to determine the type:

 d = cython.declare(cython.dict) 

Then the python interpreter in Eclipse gives me an error on this line:

AttributeError: the 'module' object does not have the 'dict' attribute

What did I miss? When I rename test.py to test.pyx, it works, but I want to save it as a .py file in order to be able to import it into other python files.

+5
source share
1 answer

Just use d = cython.declare(dict)

+3
source

Source: https://habr.com/ru/post/1243714/


All Articles