3 ms·
If you like Nim but you are looking for something that can be practical for corporate use cases where adopting a new language with a young ecosystem is extremel
by mlthoughts2018 6y ago
If you like Nim but you are looking for something that can be practical for corporate use cases where adopting a new language with a young ecosystem is extremely hard, consider Cython.
Cython is a superset of Python that allows super easily compiling custom Python extension modules directly in C or C++, interoperates easily with Python packaging, and is very battle tested.
It allows you to “just write for loops in native Python” and get the statically typed & compiled optimizations you’d get in C or C++ for free. It also supports fused types for multiple dispatch of compiled functions.
I’ve used it in production workflows at many companies. It’s very easy to use.
The best part is that you can apply it gradually, only bothering to implement small sections of code as Cython extension modules when there’s real proof from a profiler that the code is a bottleneck for reasons addressable with static typing. You don’t have to live with the huge premature optimization baked in as a premise to languages that enforce this for all code. “Static typing when _you_ need it.”
https://cython.org/ https://cython.org/
- tomrod 6y agoGreat points. The bits of cython I've used are solid.
- montebicyclelo 6y agoCython is excellent. The Numba [1] and NumPy combination is also strong. > Numba translates Python functions to optimized machine code at runtime using the industry-standard LLVM compiler library. [1] http://numba.pydata.org/ http://numba.pydata.org/