First time here? Check out the FAQ!

Ask Your Question
1

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

asked 3 years ago

greatpet gravatar image

updated 3 years ago

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

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 3 years ago

vdelecroix gravatar image

Cython has a nice documentation, check their project https://cython.org/

To answer your question

  • There is very few type inference in Cython
  • If your are manipulating Python data, Cython will not help much in getting faster code
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 368 times

Last updated: Apr 10 '21