Cython, Rust, and more: choosing a language for Python extensions

Sometimes pure Python code isn’t enough, and you need to implement an extension in a compiled language like C, C++, or Rust.
Maybe your code is slow, and you need to speed it up.
Maybe you just need access to a library written in another language.

Depending on your particular situation and needs, you may want to choose a different tool.
But which one?

Let’s see what your options are, and then go through a variety of scenarios and see which of the options is most appropriate.

C, C++, Cython, and Rust: a quick overview

All four of these languages compile down to machine code, and can potentially run orders of magnitude faster than Python.
Beyond that, they differ in many significant ways.

C

C was

 

 

 

To finish reading, please visit source site