- write a decorator that would allow the function to read its arguments from stdin and write what ever it returns to stdout.
- save the decorated function to a file, and compile it with shed skin
- call the resulting executable with os.popen, passing the arguments and receiving the output of the function.
I any case I am still sticking to my wish, hoping for suggestions of how to make it happen.
According to Mark Dufour, Shed Skin's developer, there is somebody working on using boost.python to wrap SS generated C++ code. That would be something very nice, but not as much as having a @skinner decorator.
4 comments:
hello flavio,
I'm not sure I understand what you mean (not familiar with decorators, for instance), but could a tool like decompyle help here? decompyle is a 'decompiler' that converts python bytecode into equivalent python source code. maybe you could pass your function through decompyle and then shed skin?
thanks,
mark.
btw, using boost would also open up the possibility of using arbitrary python modules from SS compiled code (such as 're'..)
thanks,
mark.
Hi Mark,
Decorators are functions that wrap other functions, adding functionality.
The problem with decompyle, besides its not suporting recent python code (>2.3), is that i expects a .pyc file as input. I was refering to something that could take a python object and return a string with the original code. But that does not exist, AFAICT.
Given this fact, I believe that putting code to be compiled into separate modules and compiling it as extension modules with BoostPython is the way to go.
I'm guessing that if you have a python object, then with some basic standard library calls, you can create a .pyc file out of it? :-) but yeah, it seems more like an interesting trick.
mark.
Post a Comment