3 ms·
While I agree with the @elcritch reply (https://news.ycombinator.com/item?id=34616755 https://news.ycombinator.com/item?id=34616755) that Nim is just nicer over
by cb321 4y ago
While I agree with the @elcritch reply (https://news.ycombinator.com/item?id=34616755 https://news.ycombinator.com/item?id=34616755) that Nim is just nicer overall, depending upon one's idea of "convenient access to literally the entirety", Cython may be more to your liking as mentioned else thread: https://news.ycombinator.com/item?id=34616052 https://news.ycombinator.com/item?id=34616052
While usually pitched as "only" a language for fast extension modules and/or bindings to existing C/C++ code, Cython is really a language in its own right. https://cython.org/ https://cython.org/ has some more details.
It works by generating C code that calls the regular CPython API, managing all the ref count and tuple jazz that's rather a hassle to write in C directly. Then you run a C compiler against this code and it literally just links against the CPython .so's/DLLs. So, it's not just calling module code the same way as CPython, but actually calling the core built-in to Python code the same way as well.
As you add more `cdef` type annotations to your cython code, the generated C code becomes closer & closer to hand-written C code (both in hazards and efficiency).
Of course, a caveat is that may be Cython also doesn't improve upon Python very much as a language, except for allowing gradual static typing.