4 ms·
If you want different parts of your code to be a statically typed Python lookalike Cython is a mature option
by srean 1y ago
If you want different parts of your code to be a statically typed Python lookalike Cython is a mature option
- leobuskin 1y agoYes, it's mature, but you (and your potential audience) basically need to learn a new language, a lot of quirks and "weird" (I'd even say counter-intuitive) nuances, and it's also significantly less readable in comparison with strict and typed Python. Even its modern syntax doesn't click immediately (also performance wise the new syntax somehow is a bit slower in my tests)
- srean 1y agoI am by no means a Cython fanboy but I think you are exaggerating the syntactic differences and readability differences. Apart from type annotation they are very minor, well worth the speed benefits and type-error benefits. Given that we are discussing it in the context of SPy, SPy is not fully compatible with Python either, which is quite understandable and in my opinion a Good trade-off. The benchmarking features are great, interactivity with C libraries is great. One annoyance I have with Cython though is debuggability. But it's an annoyance, not a show-stopper. Have used in production without problems.
- nylonstrung 1y agoIt does seems very much like "worst of both worlds" in that these nuances make it harder to write than a language like Go while still being drastically less performant