7 ms·
> Python's strength is that it's easy to make C libs work in it. SWIG[0] makes working with C libraries trivial for over a dozen programming languages; Perl, P
by AdieuToLogic 22d ago
> Python's strength is that it's easy to make C libs work in it.
SWIG[0] makes working with C libraries trivial for over a dozen programming languages; Perl, Python, and Ruby included.
0 - https://www.swig.org/ https://www.swig.org/
- frollogaston 22d agoThere are reasons all those Py libraries with C code didn't just do it in SWIG.
- AdieuToLogic 22d ago> There are reasons all those Py libraries with C code didn't just do it in SWIG. And those reasons are?
- frollogaston 21d agoThe point of SWIG is it works across many langs, but this comes at a cost. The SWIG .i and autogen'd C wrapper are extra layers that can get annoying, particularly during debug. Always hated dealing with SWIG'd libs at work. And Python C modules give easier control over Python specifics.
- AdieuToLogic 21d agoThere's no doubt that hand-written language adapter libraries are less noisy than those generated by a tool such as SWIG. The thing is, debugging tool-generated adapter code is typically more category-based than individual use-case based. IMHO, both approaches have merit depending on the situation. I lean towards using SWIG until and unless the situation warrants a hand-written solution due to the boilerplate nature of these types of libraries.