← Back to context

Comment by coppsilgold

17 hours ago

Python is basically the master glue language at this point.

If more than a few percent of execution time is spent in Python you are probably doing it wrong.

Personally I don't even understand why Cython is a thing, just write performance critical functions in other languages:

<https://pypi.org/project/rustimport/>

<https://pypi.org/project/import-zig/>

Note that you can even start threads in those languages and use function calls as pseudo-RPC. All without an overly complex build system.

Cython is a no-brainer really. You write the same language with immense speedup (matching what the "other languages" can achieve at much less effort).

Also tools like numba can beat them all at way less effort.

Imho, dropping into other languages should be the last resort in any project.

Mojo aims to be this (other language) arguably with easier programming model that rust, familiar syntax to python devs, and a modern design in general. Its stated goal now, is the easiest way to extend python. it provides the same interface for zero-hassle import of .mojo files

Cython and PyBind and Nanobind are good for wrapping an existing library written in C++ and crafting an interface that doesn’t feel like it’s a C++ one. They were a big step from ctypes and SWIG

  • Plus, even if it has a Perl like feeling to it, C++26 reflection will make this even easier.

    Already available on GCC 16.

> If more than a few percent of execution time is spent in Python you are probably doing it wrong.

Every program that starts with 1% of Python writes more Python and gets to 20,40, 60 and than 99% of it.