News for hackers. Stuff that matters.
Re:HPy – A better C API for Python by rich_sasha on Sunday October 06, 2024 @03:39AM (#41755467)
Looks very cool.

How many new extensions are written in C these days? I was under the impression it's mostly things like Boost Python, pybind or PyO3.

Re:HPy – A better C API for Python by aragilar on Sunday October 06, 2024 @04:04AM (#41755583)
There's also Cython.

I would guess also that HPy would replace the includes of `Python.h` that pybind11 et al make in order to bind to CPython, and so existing extensions should be easier to port?

Re:HPy – A better C API for Python by masklinn on Sunday October 06, 2024 @05:28AM (#41755916)
PyO3 is bindings to the C API, so if you're using PyO3 you're still using the C API even if you're not actually writing C.
Re:HPy – A better C API for Python by rich_sasha on Sunday October 06, 2024 @06:08AM (#41756087)
Yeah, sure, I mean, how many people write C to write an end-user Python module. There's stuff that genuinely wraps C libraries or predates higher level language wrappers, like numpy or matplotlib, but how many new modules are actually themselves written in C?
Re:HPy – A better C API for Python by masklinn on Sunday October 06, 2024 @12:05PM (#41758049)
The point is that’s not relevant, the issue is the API / ABI of the modules, its requirements, and its limitations, not the langage in which the modules are written.
Re:HPy – A better C API for Python by m_rcin on Sunday October 06, 2024 @06:01AM (#41756048)
for C++ 11+, pybind11 > Boost.Python

for C++ 17+, nanobind > pybind11 (both created by the same developer)

">" meaning generally better, as described at https://nanobind.readthedocs.io/en/latest/why.html

Re:HPy – A better C API for Python by physicsguy on Sunday October 06, 2024 @06:43AM (#41756213)
Quite a lot, for things like simulation code

Less so for general programming.

Re:HPy – A better C API for Python by trkannr on Sunday October 06, 2024 @07:22AM (#41756365)
A lot. You don't have to write in C, just use the C-API functions. pybind etc. introduce a whole new set of problems, with new version issues and decreased debug ability.