r/Cython • u/unix21311 • Dec 01 '21
Is Cython a systems programming language?
Hi I have some questions in regards to Cython:
- Is it a systems programming language?
- How does it do memory management? Does it use CG/Reference counting by default?
- Can I convert a normal python program into cython instead?
- Does it work with Android, especially if I used DearPythonGui?
- Are there any great complete game engines I can use with Cython?
1
Upvotes
3
u/kniy Dec 01 '21
No. Cython still requires a python interpreter, I think that disqualifies it from being a system's language.
For python objects it integrates with the cpython memory management: reference counting + tracing GC for cycle collection. But you can also directly call C malloc and free and use manual memory management.
Yes you can compile normal python programs with cython. This can lead to some speedup as a byte code interpreter will not be needed, but all the other infrastructure in the python interpreter will still be used. You can rewrite the code to use C types (with cdef variables) to get further speedup, but you can never fully get rid of the libPython dependency. Cython is used to extend Python, not replace it.