Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cython / Sage: how to use Static Typing (cdef)?

I'm looking at Sage developer guide for Cython: https://doc.sagemath.org/html/en/developer/coding_in_cython.html

But I cannot find information about how to use static typing, which is what enables Cython (not necessarily in the context of Sage) to reach C-like performance. Since objects in Sage often have complicated types (expressions, polynomials), how would type declarations (cdef in Cython) work?

Cython / Sage: how to use Static Typing (cdef)?

I'm looking at Sage developer guide for Cython: https://doc.sagemath.org/html/en/developer/coding_in_cython.html

But I cannot find information about how to use static typing, which is what enables Cython (not necessarily in the context of Sage) to reach C-like performance. Since objects in Sage often have complicated types (expressions, polynomials), how would type declarations (cdef in Cython) work?

P.S. Does Cython have some type inference capability (like the "auto" keyword in C++) so the user can avoid typing long type names?