1 year ago

#138201

test-img

Eric C.

Cython vs. Pure Python with Memoryviews

I'm just starting to learn Cython and I'm confused on an issue. If you look at the main tutorial they have examples that show a "Pure Python" mode vs. "Cython" mode. The pure python mode uses the PEP-484 type hints whereas the Cython mode introduces new keywords that aren't parsed by the python interpreter like cdef and you have to be sure to compile the .pyx file in one of the approved ways.

But I want to interact with NumPy arrays and algorithms. When I go to the most recent page on using Cython for NumPy Users there seems to be no mention of pure python modes. I don't know if that's because it's impossible with the memoryview approach detailed there or if the documentation is out of date. If I want to use NumPy arrays should I just constrain myself to using the Cython-specific syntax or is there some way of using the pure python mode as well that I'm not seeing?

python

cython

memoryview

0 Answers

Your Answer

Accepted video resources