Re: [capi-sig] Creating type object dynamically in run-time

Mateusz Loskot, 10.05.2012 15:55:
Cython works perfectly with Py3.2, even with the latest 3.3-pre and Python 2.4 and later as well. Helps you write portable code.
It's certainly much easier than doing everything in C.
I don't know what the best way is here. However, I really wonder what you are trying to achieve. If I was to implement an interface for an embedded Python runtime, I'd much rather focus on the design of the user level API that I'm exposing than the details of the low-level interface implementation. (But then again, I'd leave those mostly to Cython, so if you prefer doing them yourself, you'll have to jump through some more hoops, obviously.)
Stefan

On 10 May 2012 17:32, Stefan Behnel <python_capi@behnel.de> wrote:
Long story short, I have a software system implemented in C/C++ which provides public API. The API is not fixed, may change, so scripting engines use provided means of reflection to inspect this API and generate bindings on-fly. I embedded Python in this system and now I'm using the mentioned reflection mechanisms to discover API and generate Python extension modules and types dynamically during run-time.
I simply use the reflection mechanisms provided to iterate over definitions (structures, functions, constants, etc.) of the public API and I compose Python extension types grouping methods, etc.
I can not use Cython, nor I can use tools like SWIG, Boost.Python. The (C)Python is the only tool I can use.
Best regards,
Mateusz Loskot, http://mateusz.loskot.net

On 10 May 2012 17:32, Stefan Behnel <python_capi@behnel.de> wrote:
Long story short, I have a software system implemented in C/C++ which provides public API. The API is not fixed, may change, so scripting engines use provided means of reflection to inspect this API and generate bindings on-fly. I embedded Python in this system and now I'm using the mentioned reflection mechanisms to discover API and generate Python extension modules and types dynamically during run-time.
I simply use the reflection mechanisms provided to iterate over definitions (structures, functions, constants, etc.) of the public API and I compose Python extension types grouping methods, etc.
I can not use Cython, nor I can use tools like SWIG, Boost.Python. The (C)Python is the only tool I can use.
Best regards,
Mateusz Loskot, http://mateusz.loskot.net
participants (2)
-
Mateusz Loskot
-
Stefan Behnel