'flattening' functions for remote execution

Brian Sturk bsturk at news1.news.adelphia.net
Mon Aug 12 14:55:37 EDT 2002


I've been tinkering lately with sending python bytecode
over a socket and executing it which works quite well.
I'm using marshal etc to accomplish this.

What'd I'd like to be able to do is something sort of analagous
to inlining in C.  It seems that the func_code of a function
only has names when referencing other functions etc which
makes sense.  What I'd like to do is something like this:

Have a function like foo below (very simple example)

import bar

def foo():
    print 'in foo'

    bar.hello()

and send it to another python interpreter with the logic
to handle executing this, most likely over a network and
have the bar.hello() function resolve without
having to have the bar module on the other end, or have the
bar.hello function inlined.  I've looked into pickle/shelf/freeze 
etc and don't think they'll accomplish this from what I've read
so far.  Is there any way to do this?  I'm no expert, and I've 
run out of ideas...  I've been looking at xml-rpc too but just 
wanted to see if I could do it with straight python and sockets.

thanks

-- 
.--------------------------------------------------,---------.  
| Brian Sturk - http://users.adelphia.net/~bsturk  \  C/C++  | .>   )\,^a__
|-------------------------.  bsturk<AT>adelphia.net | Python |(  _ _)/ /-." ~
| http://www.telengard.com `------------------------`--------| `( )_ )/
| Telengard Technologies Inc. -  NT/*nix UI & device drivers |_<_s_<_s
`------------------------------------------------------------'



More information about the Python-list mailing list