> Not only that: embedding python is a shitty experience compared to embedding lua or guile...
That's a "feature", they prefer for people to extend python over embedding it in other applications.
That said, it isn't too bad unless you maintain the python c-api binding by hand since there's a lot of boilerplate and they like to change the api often.
Almost all my blender hacking was on the python API and that's crazy complicated compared to a terminal emulator. For example, all of the (context sensitive) operators are callable from python since the UI is controlled by python scripts.
> ...and you have to work around the fact that python has no threads and that it is borderline impossible to run multiple independent interpreters in the same process.
Pretty sure python has threads;P and has had subinterpreters[0] for a long time. Haven't really messed with either one other than making sure my C extensions release the GIL though.
I did attempt to embed lua in an application once and from what I can remember it was...interesting. Having to control the stack took some getting used to and their boilerplate was just as full featured as python's. I also don't remember being able to find useful automation scripts, with python I usually just bang out a quick prototype with pybindgen then hand edit it until I'm happy.
No proper concurrent threads was of course what I meant. In that light the subinterpreter feature is also not very good, since all sib-interpreters share a GIL (but iirc there is a PEP out there that might make python properly multi-core through some kind of CSP-approach and independent subinterpreters).
That's a "feature", they prefer for people to extend python over embedding it in other applications.
That said, it isn't too bad unless you maintain the python c-api binding by hand since there's a lot of boilerplate and they like to change the api often.
Almost all my blender hacking was on the python API and that's crazy complicated compared to a terminal emulator. For example, all of the (context sensitive) operators are callable from python since the UI is controlled by python scripts.
> ...and you have to work around the fact that python has no threads and that it is borderline impossible to run multiple independent interpreters in the same process.
Pretty sure python has threads;P and has had subinterpreters[0] for a long time. Haven't really messed with either one other than making sure my C extensions release the GIL though.
I did attempt to embed lua in an application once and from what I can remember it was...interesting. Having to control the stack took some getting used to and their boilerplate was just as full featured as python's. I also don't remember being able to find useful automation scripts, with python I usually just bang out a quick prototype with pybindgen then hand edit it until I'm happy.
[0] https://docs.python.org/3/c-api/init.html#sub-interpreter-su...