3 ms·
CORRECTION: I am mistaken. See https://docs.python.org/3/library/ctypes.html https://docs.python.org/3/library/ctypes.html Python is a pretty poor glue languag
by snicker7 6y ago
CORRECTION: I am mistaken. See https://docs.python.org/3/library/ctypes.html https://docs.python.org/3/library/ctypes.html
Python is a pretty poor glue language, in my experience.
Calling C APIs from Python is not pleasant. This is how one
might import the libm "error function" from Julia:
const libm = "/lib64/libm.so.6"
erf(x) = @ccall libm.erf(x::Float64)::Float64
Python requires writing/compiling a separate dll written in C (see [^1]). Python extensions are (reasonably) fast, sure. But they are not pleasant at all to write.
[^1]: https://docs.python.org/3/extending/building.html https://docs.python.org/3/extending/building.html
- jhayward 6y agoPython has a perfectly useful CFFI. There's no need to write an extension module.
- dragonwriter 6y ago> Calling C APIs from Python is not pleasant. [...] Python requires writing/compiling a separate dll written in C (see [^1]). No, it doesn't, see [0] and [1]. [0]: https://docs.python.org/3/library/ctypes.html https://docs.python.org/3/library/ctypes.html [1]: https://cffi.readthedocs.io/en/latest/ https://cffi.readthedocs.io/en/latest/
- orbifold 6y agoPybind11 is a dream to work with and there are python packages that implement hot reloading for C++ into a live python session aswell as autogeneration tools for it.