On 05/19/2014 03:40 AM, Chris Angelico wrote: > On Mon, May 19, 2014 at 5:41 AM, Roland Plüss <rol...@rptd.ch> wrote: >> This exec source_code in module.__dict__ , should this not also be doable >> with PyEval_EvalCode? > General principle: The more code you write in Python and the less in > C/C++, the happier and more productive you will be. > > Drop into Python as soon as you can, and do all the work from there. > You won't have to worry about RAM (de)allocation, Unicode (especially > if you use Python 3 rather than 2), integer overflow, etc, etc, etc. > Only write lower-level code for the bits that actually demand it; and > as Stefan has pointed out, Cython is a great help there. > > (Which reminds me. I still need some "excuse project" to justify my > learning Cython. It's good-looking tech but everything I can imagine > writing seems to already exist.) > > ChrisA Cython is out of question since link time dependencies has to be kept at an utmost minimum. An concerning doing things from python code it's simply not possible (or I don't know how this should work). Python is fully embedded including any file actions (virtual file system). The launch comes from C++ land. No interpreter is involved. The main work is done outside Python and only dropped in python to do higher logic. This also means the very first python code run requires a C++ script file loading before this first code can ever run. I can't run code that doesn't yet exist in the reach of the python VM. That's the main problem. This is why I need to figure out how to push that first code into Python in a way I can construct an object (from a predefined class). From there on all calls into Python land are solely done trough function calls on this one object obtained in the beginning. I see no other way to handle the problem.
-- Yours sincerely Plüss Roland Leader and Head Programmer - Game: Epsylon ( http://www.indiedb.com/games/epsylon ) - Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine , http://dragengine.rptd.ch/wiki ) - Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php ) - As well as various Blender export scripts und game tools
signature.asc
Description: OpenPGP digital signature
-- https://mail.python.org/mailman/listinfo/python-list